网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
ClassOne.java package com.abc.pkg1; public class ClassOne { private char var = ‘a‘; char getVar() {return var;} } ClassTest.java package com.abc.pkg2; import com.abc.pkg1.ClassOne; public class ClassTest extends ClassOne { public static void main(Stringargs) { char a = new ClassOne().getVar(); char b = new ClassTest().getVar(); } } What is the result?()
- A、 Compilation will fail.
- B、 Compilation succeeds and no exceptions are thrown.
- C、 Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.
- D、 Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.
参考答案
更多 “ ClassOne.java package com.abc.pkg1; public class ClassOne { private char var = ‘a‘; char getVar() {return var;} } ClassTest.java package com.abc.pkg2; import com.abc.pkg1.ClassOne; public class ClassTest extends ClassOne { public static void main(Stringargs) { char a = new ClassOne().getVar(); char b = new ClassTest().getVar(); } } What is the result?() A、 Compilation will fail.B、 Compilation succeeds and no exceptions are thrown.C、 Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.D、 Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.” 相关考题
考题
ClassOne.java:1.packagecom.abe.pkg1;2.publicclassClassOne{3.privatecharvar=‘a’;4.chargetVar(){returnvar;}5.}ClassTest.java:1.packagecom.abe.pkg2;2.importcom.abc.pkg1.ClassOne;3.publicclassClassTestextendsClassOne{4.publicstaticvoidmain(String[]args){5.chara=newClassOne().getVar();6.charb=newClassTest().getVar();7.}8.}Whatistheresult?()A.Compilationfails.B.Compilationsucceedsandnoexceptionsarethrown.C.Anexceptionisthrownatline5inClassTest.java.D.Anexceptionisthrownatline6inClassTest.java.
考题
在Protel中利用向导创建元件封装时,如果是双列直插元件,须选择()样式。A、Quad Packa(QUAD)B、Leadless Chip CarrierC、Pin Grid ArraysD、Dual in-line Package
考题
ClassOne.java: 1. package com.abe.pkg1; 2. public class ClassOne { 3. private char var = ‘a’; 4. char getVar() { return var; } 5. } ClassTest.java: 1. package com.abe.pkg2; 2. import com.abc.pkg1.ClassOne; 3. public class ClassTest extends ClassOne { 4. public static void main(String[] args) { 5. char a = new ClassOne().getVar();6. char b = new ClassTest().getVar(); 7. } 8. } What is the result?()A、 Compilation fails.B、 Compilation succeeds and no exceptions are thrown.C、 An exception is thrown at line 5 in ClassTest.java.D、 An exception is thrown at line 6 in ClassTest.java.
考题
单选题ClassOne.java 1. package com.abc.pkg1; 2. public class ClassOne { 3. private char var = ‘a’; 4. char getVar() {return var;} 5. } ClassTest.java 1. package com.abc.pkg2; 2. import com.abc.pkg1.ClassOne; 3. public class ClassTest extends ClassOne { 4. public static void main(String[]args) { 5. char a = new ClassOne().getVar(); 6. char b = new ClassTest().getVar(); 7. } 8. } What is the result?()A
Compilation will fail.B
Compilation succeeds and no exceptions are thrown.C
Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.D
Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.
考题
单选题ClassOne.java package com.abc.pkg1; public class ClassOne { private char var = ‘a‘; char getVar() {return var;} } ClassTest.java package com.abc.pkg2; import com.abc.pkg1.ClassOne; public class ClassTest extends ClassOne { public static void main(Stringargs) { char a = new ClassOne().getVar(); char b = new ClassTest().getVar(); } } What is the result?()A
Compilation will fail.B
Compilation succeeds and no exceptions are thrown.C
Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.D
Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.
热门标签
最新试卷