网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
Given the command line java Pass2 and: public class Pass2{ public void main(String[]args){ int x=6; Pass2 p=new Pass2(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()
- A、Compilation fails.
- B、An exception is thrown at runtime.
- C、doStuffx=6 main x=6
- D、doStuffx=6 mainx =7
- E、doStuffx=7 mainx =6
- F、doStuffx=7 mainx =7
参考答案
更多 “ Given the command line java Pass2 and: public class Pass2{ public void main(String[]args){ int x=6; Pass2 p=new Pass2(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()A、Compilation fails.B、An exception is thrown at runtime.C、doStuffx=6 main x=6D、doStuffx=6 mainx =7E、doStuffx=7 mainx =6F、doStuffx=7 mainx =7” 相关考题
考题
Which statement is true about assertion in the Java programming language?() A、 Assertion expressions should not contain side effects.B、 Assertion expression values can be any primitive type.C、 Assertion should be used for enforcing preconditions on public methods.D、 An AssertionError thrown as a result of a failed assertion should always be handled by the enclosing method.
考题
Given: 11.% 12.request.setAttribute("vals", new String[]{"1","2","3","4"}); 13.request.setAttribute("index", "2"); 14.% 15.%-- insert code here --% Which three EL expressions, inserted at line 15,are valid and evaluate to "3"?()A、${vals.2}B、${vals["2"]}C、${vals.index}D、${vals[index]}E、${vals}[index]F、${vals[vals[index-1]]}
考题
Which element of a web application deployment descriptor element is required?()A、realm-nameB、auth-methodC、security-roleD、transport-guaranteeE、web-resource-collection
考题
现有: -f是一个合法的java.io.File实例的引用 - fr是一个合法的java.io.FileReader实例的引用 - br 是一个合法的java.io.BufferedReader实例的引用 哪两个是合法的?() A、 File f2=new File (f);B、 FileReader fr2=new FileReader (fr);C、 FileReader fr2=new FileReader(f);D、 FileReader fr2=new FileReader(br);E、 BufferedReader br2 =new BufferedReader (f);F、 BufferedReader br2=new BufferedReader (fr);
考题
现有: 1. class Propeller2 { 2. pulolic static void main (String[]args)//add code here? 3. { new Propeller2().topGo(); } 4. 5.void topGo() //add code here? 6. { middleGo(); } 7. 8.void middleGo() //add code here? 9. { go(); System.out.println ("late middle"); } void go() //add code here? 12. {throw new Exception(); } 13. } 为使代码通过编译,需要在哪一行加入声明throws Exception?() A、只在第11行B、在第8行和第11行C、在第5行、第8行和第11行D、在第2行、第5行、第8行和第11行
考题
public class Foo { static int[] a; static { a[0]=2; } public static void main( String[] args) {} } Which exception or error will be thrown when a programmer attempts to run this code?() A、 java.lang. StackOverflowErrorB、 java.lang.IllegalStateExceptionC、 java.lang.ExceptionlnlnitializerErrorD、 java.lang.ArraylndexOutOfBoundsException
考题
Given the following code, which code fragments, when inserted at the indicated location, will succeed in making the program display a button spanning the whole window area?() import java.awt.*; public class Q1e65 { public static void main(String args[]) { Window win = new Frame(); Button but = new Button("button"); // insert code fragment here win.setSize(200, 200); win.setVisible(true); } } A、win.setLayout(new BorderLayout()); win.add(but);B、win.setLayout(new GridLayout(1, 1)); win.add(but);C、win.setLayout(new BorderLayout()); win.add(but, BorderLayout.CENTER);D、win.add(but);E、win.setLayout(new FlowLayout()); win.add(but);
考题
如何创建一个表格包型布局管理器的约束对象?() A、 调用组件的setConstraints函数B、 调用面板的setConstraints函数C、 创建并设置一个GridBagConstraints对象D、 调用表格包型布局管理器的setConstraints函数
热门标签
最新试卷