A method may declare to throw multiple exceptions. (True/False) abstract class E
ID: 3778493 • Letter: A
Question
A method may declare to throw multiple exceptions. (True/False) abstract class E can have regular methods. (True/False) public abstract int p() {return x}; The statement has syntax errors. (True/False) An interface may contain constructors. (True/False) In java, a class can extend more than one class. Abstract and Interface. Given the following Java statement, class A {} interface B {} interface D {} abstract class E {} Please indicate if the following Java statements has syntax error. (Yes/No) class X extends A, E {} (Yes/No) class X extends E implements D {} (Yes/No) interface Y implements A {} (Yes/No) class X implements B, D {} (Yes/No) class X implements E implements D {} Please select True or False for the following questions. class Person5 {String name="Unknown";} class Faculty5 extends Persons implements fun {public void p(String n) {super.name=n;}} interface fun {public void p(String n);} public class Test {public static void main(String [] args) {Persons p=new Persons5 (); Faculty5 f = new Faculty5(); f .p("Mary"); System.out.println(p instanceof Faculty5);//System.out.println(p instance of fun);//System.out.println(f instanceof Persons);//System.out.println(f instanceof fun);//System.out.println(p.name);//System.out.println(f.name);//}}Explanation / Answer
Answers
3)
1.True
2.True
3.True
4.False
5.False
4)
1.yes class X extends A,E
2.no class X extends E implements D
3.yes interface Y implemnets A
4.no class X implements B,D
5.yes class X implements E implements D
5)
System.out.println("p instance of faculty5"); //false
System.out.println("p instance of fun"); //false
System.out.println("f instance of person5"); //true
System.out.println("f instance of fun"); //true
System.out.println(p.name); //true prints Unkown
System.out.println(f.name); //true prints Mary
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.