有如下代码段: public static void booleantest() { int a = 1, b =1; if (a == b || b<0) a ; if (a <= 2 &&(!(b<0))) b=b<<1; system.out.println(a "," b); } 则运行结果为:
如下赋值语句中,有语法错误的是?
有如下类定义: public class rectangle { public int width = 3; public int height = 4; public int area() { return width * height; } } 则如下代码输出结果为: rectangle rectangle; rectangle.height = 5; system.out.println(rectangle.area());
执行如下代码片段后,i和n的值分别为: int i = 10; int n =( i ) % 5;
执行如下代码片段后,num的值为: int num = 5; num = (num % 2) == 0 ? num – 1 : num 1;
有如下代码段: if (num >= 0) if (num == 0) system.out.println("first string"); else system.out.println("second string"); system.out.println("third string"); 若num为3,则输出结果为:
下列变量名称中,不属于有效java变量命名的是?
对于java1.7及之后版本,如下不能用于switch的类型是:
如下对java基本类型的描述,错误的是?
如下循环结构中,输出结果与其它三组不一致的一组是:
swap方法定义如下: public static void swap(int num1, int num2) { int temp = num1; num1 = num2; num2 = temp; } 执行如下代码后, int num1 = 10; int num2 = 5; int num3 = 20; swap(num1, num2); swap(num2, num3); num1, num2, num3的值分别为:
number类定义如下: public class number { public int x; } swap方法定义如下: public static void swap(number number1, number number2) { int temp = number1.x; number1.x = number2.x; number2.x = temp; } 运行如下代码: number number1 = new number(); number number2 = new number(); number number3 = new number(); number1.x = 1; number2.x = 2; number3.x = 3; swap(number1, number2); swap(number2, number3); 则number1.x, number2.x, number3.x的值分别为:
assume i and j are member variables with double type in class x. in the following codes, which one is not right constructor? ( )
given: class cardboard { short story = 5; cardboard go(cardboard cb) { cb = null; return cb; } public static void main(string[] args) { cardboard c1 = new cardboard(); cardboard c2 = new cardboard(); cardboard c3 = c1.go(c2); c1 = null; // do stuff } } when // dostuff is reached, how many objects of cardboard are null?
given the uncompleted code of a class: class person { string name, department; int age; public person(string n){ name = n; } public person(string n, int a){ name = n; age = a; } public person(string n, string d, int a) { // doing the same as two arguments version of constructor // including assignment name=n,age=a department = d; } } which expression can be added at the "doing the same as..." part of the constructor?
given the following class class mynumber { private int num = 5; public mynumber(int num) { this.num = num; } public int getnum() { return num; } public void setnum(int num) { this.num = num; } } what is output after the executation of following code? mynumber obj1 = new mynumber(); mynumber obj2 = new mynumber(10); obj2 = obj1; obj2.setnum(20); system.out.println(obj1.getnum() “,” obj2.getnum());
given the following class: class mixer { mixer() { } mixer(mixer m) { m1 = m; } mixer m1; public static void main(string[] args) { mixer m2 = new mixer(); mixer m3 = new mixer(m2); m3.go(); mixer m4 = m3.m1; m4.go(); mixer m5 = m2.m1; m5.go(); } void go() { system.out.print("hi "); } } what is the result?
现有 public class parent{ public void change (int x){ } } public class child extends parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?
class ca{ int num = 1; ca(int num){ this.num = num; system.out.print(this.num); } } class cb extends ca{ int num = 2; cb(int num) { this.num = num; system.out.print(num); } public static void main(string[] args) { ca a = new cb(5); } } 运行代码,程序输出结果为:
下面关于继承的叙述正确的是()
给定下列程序,请选出正确结果。 class cat { cat (int c) { system.out.print ("cat" c " "); } } class subcat extends cat { subcat (int c){ super (5); system.out.print ("cable"); } subcat() { this (4); } public static void main (string [] args) { subcat s= new subcat(); } }
下列程序的输出是()。 class other{ public other () { system.out.print("other!"); } } public class driver1 extends other { public static void main( string[] args ) { new driver1(); new other (); } }
请选出以下程序的输出结果 class a { public void func1() { system.out.println("a func1 is calling"); } public void func2() { func1(); } } class b extends a { public void func1() { system.out.println("b func1 is calling"); } public void func3() { system.out.println("b func3 is calling"); } } class c { public static void main(string[] args) { a a = new b(); a.func1(); a.func2(); a.func3(); } }
请选出以下程序的输出结果 public class child extends people { people father; public child(string name) { system.out.print(3); this.name = name; father = new people(name ":f"); } public child() { system.out.print(4); } public static void main(string[] args) { new child("alice"); } } class people { string name; public people() { system.out.print(1); } public people(string name) { system.out.print(2); this.name = name; } }
请选出正确答案 class parent { string one, two; public parent(string a, string b){ one = a; two = b; } public void print(){ system.out.println(one); } } public class child extends parent { public child(string a, string b){ super(a,b); } public void print(){ system.out.println(one " to " two); } public static void main(string arg[]){ parent p = new parent("south", "north"); parent t = new child("east", "west"); p.print(); t.print(); } }
请选择正确的输出结果 class guy { public guy(){ system.out.print("111,"); } } class cowboy extends guy { public cowboy(){ system.out.print("222,"); } } class wrangler extends cowboy { public wrangler(){ system.out.print("333,"); } } public class greeting2 { public static void main(string[] args) { guy g1 = new guy(); guy g2 = new cowboy(); guy g3 = new wrangler(); } }
给定以下程序 class pencil { public void write (string content){ system.out.println( "write" content); } } class rubberpencil extends pencil{ public void write (string content){ system.out.println("rubber write" content); } public void erase (string content){ system.out.println( "erase " content); } } 执行下列代码的结果是哪项? pencil p=new pencil(); (( rubberpencil) p).write("hello");
下面关于变量及其范围的陈述哪些是错误的
下列说法错误的是
以下代码 class finaltest{ int num = 1; public static void main(string[] args) { final finaltest ft = new finaltest();//1 ft.num = 100;//2 //3 system.out.println(ft.num);//4 } }
下列代码执行结果是 class numtest{ static int id = 1; int id2 = 1; numtest(int id,int id2){ this.id = id; this.id2 = id2; } void printid(){ system.out.print(id id2 " "); } public static void main(string[] args) { numtest a = new numtest(1,2); numtest b = new numtest(2,1); numtest c = new numtest(0,0); a.printid(); b.printid(); c.printid(); } }
以下代码 class finaltest{ final int num = 1; public static void main(string[] args) { final finaltest ft = new finaltest();//1 ft.num = 100;//2 //3 system.out.println(ft.num);//4 } }
class numtest{ final int id = 1; int id2 = 1; numtest(int id,int id2){ this.id = id; this.id2 = id2; } void printid(){ system.out.print(id id2 " "); } public static void main(string[] args) { numtest a = new numtest(1,2); numtest b = new numtest(2,1); numtest c = new numtest(0,0); a.printid(); b.printid(); c.printid(); } }
下列代码执行结果是 class numtest{ final static int num1 = 1; static int num2 = 1; void printnum1(){ system.out.print(num1 " "); } void printnum2(){ system.out.print(num2 " "); } public static void main(string[] args) { numtest a = new numtest(); a.num2 ; a.printnum1(); numtest b = new numtest(); b.printnum2(); } }
下列代码执行结果是 class numtest{ final static int num1 = 1; static int num2 = 1; void printnum1(){ system.out.print(num1 " "); } void printnum2(){ system.out.print(num2 " "); } public static void main(string[] args) { numtest a = new numtest(); a.num1 ; a.printnum2(); numtest b = new numtest(); b.printnum1(); } }
以下代码执行结果是 class statictest{ static{ system.out.print("a "); } static{ system.out.print("b "); } public static void main(string[] args) { statictest st1 = new childtest(); } } class childtest extends statictest{ static{ system.out.print("c "); } }
以下代码执行结果是 class statictest{ static{ system.out.print("a "); } { system.out.print("b "); } public static void main(string[] args) { statictest st2 = new childtest(); //main1 system.out.print(“ # ”); //main2 statictest st = new statictest(); //main3 } } class childtest extends statictest{ static{ system.out.print("c "); } }
有如下类定义: public class classandvariables{ public static int x = 8; public int y = 9; } 执行如下代码: classandvariables a = new classandvariables(); classandvariables b = new classandvariables(); a.y = 5; b.y = 6; a.x = 1; b.x = 2; 则a.y, b.y, a.x, b.x的值分别为:
请阅读以下程序,并写出结果 public class argumentpassing { public static void changevalue(int a) { a = 10; } public static void changevalue(string s1){ s1 = "def"; } public static void changevalue(stringbuffer s1) { s1.append("def"); } public static void main(string[] args) { int a = 5; string b = "abc"; stringbuffer c = new stringbuffer("abc"); changevalue(a); changevalue(b); changevalue(c); system.out.print(a); system.out.print(b); system.out.print(c); } }
下列关于构造方法的叙述中,错误的是
关于以下程序段,正确的说法是()。 string s1= "abc" "def"; //1 string s2= new string(s1); //2 if (s1==s2) //3 system.out.println("= = succeeded"); //4 if (s1.equals(s2)) //5 system.out.println(".equals() succeeded"); //6
请阅读以下程序,并写成结果。 class father { public void hello() { system.out.println("father says hello."); } } public class child extends father { public void hello() { system.out.println("child says hello"); } public static void main(string[] a) { child foo = new child(); //foo.hello(); father foo2 = (father) foo; //foo2.hello(); child foo3 = (child) foo2; //foo3.hello(); system.out.println(foo==foo2); system.out.println(foo==foo3); } }
运行如下程序,输出结果是()。 stringbuffer = new stringbuffer("good morning!"); string sub = .substring(0, 8); system.out.println(sub); system.out.print("/"); char c = .charat(6); system.out.println(c);
如下所示的test类的java程序中,共有几个构造方法()。 public class test{ private int x; public test(){} public void test(int i){ this.x=i; } public test(string str){}}
下面代码的运行结果为:() public class foo { static string s; public static void main (string[]args) { system.out.println ("s=" s); } }
已知如下代码:( ) public class test { public static void main(string arg[] ) { int i = 5; do{ system.out.print(i); }while(-i>5); system.out.print("finished"); } } 执行后的输出是什么?
given: abstract class bar { public int getnum() { return 38; } } public abstract class abstracttest { public int getnum() { return 45; } public static void main(string[] args) { abstracttest t = new abstracttest() { public int getnum() { return 22; } }; bar f = new bar() { public int getnum() { return 57; } }; system.out.println(f.getnum() " " t.getnum()); } } what is the result?
public class child extends people { people father; public child(string name) { system.out.print(3); this.name = name; father = new people(name ":f"); } public child() { system.out.print(4); } public static void main(string[] args) { new child("alice"); } } class people { string name; public people() { system.out.print(1); } public people(string name) { system.out.print(2); this.name = name; } }
现有: class guy{ string greet(){ return "hi "; }} class cowboy extends guy{ string greet(){ return "howdy "; }} class wrangler extends cowboy{ string greet(){ return "ouch! "; } } class greetings2 { public static void main (string [] args) { guy g=new wrangler(); guy g2=new cowboy(); wrangler w2=new wrangler(); system.out.print(g.greet() g2.greet() w2.greet()); } } 结果是什么?
现有: class tree { private static string tree = "tree"; string gettree() { return tree; } } public class elm extends tree { private static string tree = "elm"; public static void main(string[] args) { new elm().go(new tree()); } void go(tree t) { string s = t.gettree() elm.tree tree (new elm().gettree()); system.out.println(s); } }
接口是java面向对象的实现机制之一,以下说确的是:( )
如果想要一个类不能被任何类继承的话,需要使用哪个关键字来修饰该类?
class person { private int a; public int change(int m){ return m; } } public class teacher extends person { public int b; public static void main(string arg[]){ person p = new person(); teacher t = new teacher(); int i; // point x } } which are syntactically valid statement at // point x?
请问以下代码的输出是什么: class a { public static int x = 10; public static void printx() { system.out.print(x); } } public class elm extends a { public int x = 20; public static void main(string[] args) { a a = new elm(); printx(); system.out.print("和"); system.out.print(a.x); } }
类 teacher 和 student 是类 person 的子类; teacher t; student s; // t and s are all non-null. if (t instanceof person ){ s=(student)t; } 最后一条语句的结果是:
下述代码的执行结果是 class super { public int getlength() { return 4; } } public class child extends super { public long getlength() { return 5; } public static void main(string[] args) { super sooper = new super(); super sub = new child(); system.out.print(sooper.getlength() "," sub.getlength()); } }
下列关于interface的说确的是:
验证身份证号码是否正确
验证身份证号码是否正确(带校验算法)
给出如下代码段: try { int x = integer.parseint("two"); } 下列哪个可以作为catch的异常?
给出下列代码: class plane { static string s = "-"; public static void main(string[] args){ new plane().s1(); system.out.println(s); } void s1() { try {s2();}catch (exception e){ s = "c"; } } void s2() throws exception { s3(); s = "2"; s3(); s = "2b"; } void s3() throws exception{ throw new exception(); } } 结果是什么?
下列程序的执行,说确的是( ) class multicatch { public static void main(string args[]) { try { int a=args.length; int b=42/a; int c[]={1}; c[42]=99; //10行 system.out.println(“b=” b); } catch(arithmeticexception e) { system.out.println(“除0异常:” e); //15行 } catch(arrayindexoutofboundsexception e) { system.out.println(“数组超越边界异常:” e); //19行 } } }
pubic void test () { try { onemethod (); system.out.print ( "condition 1"); } catch ( exception e ) { system.out.print ( "condition 3"); } catch ( arithmeticexception e ) { system.out.print ( "condition 2" ); } finally { system.out.println ("condition 4" ); } } which will display if onemethod throw nullpointerexception?
given: import java.io.*; class master { string dofilestuff() throws filenotfoundexception { return "a"; } } class slave extends master { public static void main(string[] args){ string s = null; try { s = new slave().dofilestuff();}catch ( exception x){ s = "b"; } system.out.println(s); } // insert code here } which, inserted independently at // insert code here, will compile, and produce the output b? (choose all that apply.)
given import java.io.*; class main{ public void f1() throws arithmeticexception{} public void f2() throws filenotfoundexception{} public static void main(){ new main().f1(); //line1 new main().f2(); //line2 } } which is correct?
class emu{ static string s = "-"; public static void main(string[] args){ try{ throw new exception(); }catch(exception e){ try{ try{ throw new exception(); }catch (exception ex){ s = "ic "; } throw new exception(); } catch(exception x){ s = "mc "; } finally{ s = "mf "; } }finally{ s = "of "; } system.out.println(s); } } what is the result?
given: class mineral{ } class gem extends mineral{ } class miner{ static int x = 7; static string s = null; public static void getweight(mineral m){ int y = 0 / x; system.out.print(s " "); } public static void main(string[] args){ mineral[] ma = {new mineral(), new gem()}; for(object o : ma) getweight((mineral) o); } } and the command-line invocation: java miner what is the result?
请完成汇率和金额排序程序。
给定: public class test { public static void main(string [] args) { int x = 5; boolean b1 = true; boolean b2 = false; if((x==4) && !b2) system.out.print(“l “); system.out.print(“2 “); if ((b2 = true) && b1) system.out.print(“3 “); } } 输出结果为?
给定: 31. // some code here 32. try { 33. // some code here 34. // some code here 35. } catch (someexception se) { 36. // some code here 37. // some code here 38. } finally { 39. // some code here 40. // some code here 41. } 如下哪些情况出现时第39行中代码不会被执行?
给定: 10. interface foo {} 11. class alpha implements foo { } 12. class beta extends alpha {} 13. class delta extends beta { 14. public static void main( string[] args) { 15. beta x = new beta(); 16. // insert code here 17. } 18. } 哪一选项中代码插入到第16行, 会抛出 java.lang.classcastexception?
给定: 1. class testa { 2. public void start() { system.out.println(“testa”); } 3. } 4. public class testb extends testa { 5. public void start() { system.out.println(“testb”); } 6. public static void main(string[] args) { 7. ((testa)new testb()).start(); 8. } 9. } 结果为?
给定: 11. public abstract class shape { 12. int x; 13. int y; 14. public abstract void draw(); 15. public void setanchor(int x, int y) { 16. this.x = x; 17. this.y = y; 18. } 19. } 并且类circle继承并实现了shape 如下哪项是正确的?
给定类定义: 1. public class test { 2. int x= 12; 3. public void method(int x) { 4. x =x; 5. system.out.println(x); 6. } 7. } 给定: 34. test t = new test(); 35. t.method(5); 则testclass中第5行输出结果为:
请阅读以下程序,并写出结果 public class argumentpassing { public static void changevalue(int a) { a = 10; } public static void changevalue(string s1){ s1 = "def"; } public static void changevalue(stringbuffer s1) { s1.append("def"); } public static void main(string[] args) { int a = 5; string b = "abc"; stringbuffer c = new stringbuffer("abc"); changevalue(a); changevalue(b); changevalue(c); system.out.print(a); system.out.print(b); system.out.print(c); } }
请阅读以下程序,并写成结果。 class father { public void hello() { system.out.println("father says hello."); } } public class child extends father { public void hello() { system.out.println("child says hello"); } public static void main(string[] a) { child foo = new child(); //foo.hello(); father foo2 = (father) foo; //foo2.hello(); child foo3 = (child) foo2; //foo3.hello(); system.out.println(foo==foo2); system.out.println(foo==foo3); } }
如下关于jdk和jre的说法,错误的是?
下列代码执行结果是 class numtest{ final static int num1 = 1; static int num2 = 1; void printnum1(){ system.out.print(num1 " "); } void printnum2(){ system.out.print(num2 " "); } public static void main(string[] args) { numtest a = new numtest(); a.num2 ; a.printnum1(); numtest b = new numtest(); b.printnum2(); } }
pubic void test () { try { onemethod (); system.out.print ( "condition 1"); } catch ( exception e ) { system.out.print ( "condition 3"); } catch ( arithmeticexception e ) { system.out.print ( "condition 2" ); } finally { system.out.println ("condition 4" ); } } which will display if onemethod throw nullpointerexception?
the three major forms of public speaking are speaking to inform, to persuade, and to entertain.
to be a good public speaker, you need to be a good user of language.
communication is the creation of shared understanding through symbolic processes.
in public speaking, receivers also send messages nonverbally while the speaker presents his/her message.
public speaking is a powerful tool for social change and civic participation.
you need critical thinking when preparing your speech.
the nature of public speaking is communication. communication can be defined as:
overall, great public speakers are:
what are the three general purposes for giving speeches?
which element of the speech communication process involves the time and place in which communication occurs?
public speakers who seek to communicate with listeners from cultures other than their own need to take special care to avoid ____ in their speeches.
what are the causes of stage fright in public speaking?
stage fright can be a good thing.
how to deal with stage fright in public speaking?
you can reduce your stage fright by shifting the focus from yourself and your fear to your true purpose, that is, contributing something of value to your audience.
you can reduce your stage fright if you consider your audience as a pile of potatos that you can overlook.
the speaker's biggest enemy is:
speakers must be confident. the best way to become confident is to:
which of the following is recommended as a way to deal with nervousness in your speeches?
stage fright is a condition you should try to totally eliminate.
while of the following is not right?
which sentence about ethics is not correct?
which of the following statement is not right?
please choose the sentence(s) with an error in reasoning.
the hasty generalization fallacy relates to inductive reasoning and is the result of too few examples being cited to warrant the generalization.
unethical speakers usually disguise message through fallacies and deceive listeners to achieve their goals.
what kind of topics are important for a speech?
which of the following is not typically considered to be a guideline for ethical speechmaking?
the most correct way to cite an internet source is:
which of the following students have effectively combined audience ysis with ethics:
when giving a speech, speakers must cite sources by:
ethics refers to fundamental questions of right and wrong in thought and behavior.
which statement about opening is incorrect?
why introduction is important in public speaking?
boring speech usually lacks lively, relevant, and interesting examples or quotations.
supporting matterials help capture and maintain an audience's attention.
speakers need evidence to support what they say.
without relevant examples and solid statistics, a speaker's ideas may be diissed.
for some people, "school" may connote personal growth, and a special teacher; for others, "school" may connote frustration, discipline, and boring homework.
don't use a word until you are sure of its meaning.
concrete words are those words that refer to tangible objects, including people, places, and things.
abstract words are words that refer to ideas or concepts.
in most cases, an introduction should not constitute more than _____% of a speech.
which of the following words or phrases is most concrete?
a speaker plans to give a speech about the development of the pony express. in order to deliver her speech most effectively, she should arrange the main points of her speech in _____ order.
the task is heavy, the toil is long, and the trials will be severe (winston churchill) is an example of
when speakers quote or paraphrase the words of another person to support their ideas, they are using the device of _____ as support.
when researching materials for your speech, you should:
effective speech transitions can help to
the ____ of a speech is its largest portion, in which the speaker places his or her arguments and ideas, substantiation and examples, and proofs and illustrations.
an ______ is a "written plan that uses symbols, margins, and content to reveal the order, importance, and substance of your speech."
phrases which indicate where you are in the speech such as, "first, i will illustrate..., " "a second idea is...," "finally, we will...," "furthermore, you should consider...", and "in conclusion..." are called ___________.
you should adjust the volume of your voice according to the size and the shape of the setting.
if there is a microphone, you should know how to use and adjust to it.
if you speak softly, you may project an unconfident, insincere image and you may lose the interest and attention of your audience.
your personal appearance can give the audience the first impression and impact.
when you speak, your eyes also function as a control device you can use to assure your listener's attentiveness and concentration.
when speak in public, you should look listeners in the eye but avoid fixing your eyes at one person or one area for a long time.
postures deals with how the body is positioned in relation to another person or group of persons.
when you speak, you can shift from foot to foot and swing from side to side.
when you speak, you can move your hands and arms freely.
visual aids are usually used to:
which of the following sentence about using visual aids is correct?
there is a simple rule of moving as a speaker. it is:
when you make eye contact, it connects with the audience because:
when using visual aids in a speech, you should:
when delivering a speech, which of the following means of support is most likely to require the use of visual aids?
each of the following should be used as a guideline for using visual aids to a presentation except
when creating a visual aid, you should keep in mind the size of the room in which you will be speaking? true or false
in most circumstances, a speaker should avoid passing visual aids among the audience? true or false
in most circumstances you should keep your visual aids on display throughout the speech? true or false
a speech to inform shares information with others to enhance their knolwedge or understanding of the information, concepts, and ideas you present.
informative speech should be relevant, new, clear, creative, and different.
you should avoid making your speech too long.
persuasion is the process of creating, reinforcing, or changing people's beliefs or actions.
question of value is a question about the worth, rightness, morality, and so forth of an idea or action.
question of policy is whether a specific course of action should be or should not be taken.
which of the following is an instance of persuasive speaking:
the three types of questions that give rise to persuasive speeches are
what are the 5 steps of the monroe sequence?
persuasive speeches typically involve each of the following except questions of
which of the following is not a guideline that should be followed in the composition of a speaker's purpose statement? it should
_____ is the detailed explanation of facts and ideas.
each of the following is a common function of a speech of presentation except
when you give a persuasive speech on a question of value, you need to:
" to persuade my audience that lee harvey oswald was the sole assassin of president john f. kennedy" is a specific purpose statement for a persuasive speech on a question of fact. true or false
questions of policy inevitably incorporate questions of fact. true or false
"to persuade my audience that capital punishment does not deter people from committing crimes such as murder: is a specific purpose statement for a persuasive speech on a question of policy.
persuasive speeches on questions of ____ judge whether something is good or bad, right or wrong, fair or unfair.
good delivery is listener-centered.
you should avoid wearing anything that will detract audience when delivering a speech.