Course Hero Logo

What is the outputof below code package p1 abstract

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 37 - 40 out of 130 pages.

What is the outputof below code:package p1;abstract class LivingThings{public abstract int walk();}class Human extends LivingThings{@Overridepublic void walk() {System.out.println("Human Can Walk");}}class Test {public static void main(String[] args) {new Human().walk();}}Human Can Walk
CoreJava-Inheritance,Interfaces & AbstractClasses-ApplicationCarefully read the question and answer accordingly.What will be the output of following code?class InterfaceDemo{public static void main(String [] args){new DigiCam(){}.doCharge();new DigiCam(){public void writeData (String msg){System.out.println("You are Sending: "+msg);}}.writeData("MyFamily.jpg");}//main}interface USB{int readData();void writeData(String input);void doCharge();}abstract class DigiCam implements USB{public int readData(){ return 0;}public void writeData(String input){}public void doCharge(){System.out.println("DigiCam do Charge");}}DigiCam do Charge You areSending: MyFamily.jpgCoreJava-Inheritance,Interfaces & AbstractClasses-ApplicationCarefully read the question and answer accordingly.What is the output of below code:package p1;public class Test {public static void main(String[] args) {Test t1 = new Test();Test t2 = new Test();if (!t1.equals(t2))System.out.println("they're not equal");if (t1 instanceof Object)System.out.println("t1's an Object");}}they're not equalCoreJava-Inheritance,Interfaces & AbstractClasses-ApplicationCarefully read the question and answer accordingly.State whether TRUE or FALSE.A concrete class can extend more than one superclass whether that super class is either concrete orabstract classTRUECoreJava-Inheritance,Interfaces & AbstractClasses-ApplicationCarefully read the question and answer accordingly.public class Client1{public static void main(String [] args){PenDrive p;Class cannot be defined insideanother class
PenDrive.Vendor v1=newPenDrive.Vendor("WD",500);System.out.println(v1.getName());System.out.println(v1.getPrice());}}class PenDrive{static class Vendor{String name;int price;public String getName(){ return name;}public int getPrice(){ return price;}Vendor(String name,int price){this.name=name;this.price=price;}}}What will be the output of the given code?CoreJava-Inheritance,Interfaces & AbstractClasses-ApplicationCarefully read the question and answer accordingly.State whether TRUE or FALSE.The super() call can only be used in constructor callsand not method calls.TRUECoreJava-Inheritance,Interfaces & AbstractClasses-ApplicationCarefully read the question and answer accordingly.Abstract classes can be used whenStatement I: Some implemented functionalities arecommon between classesStatement II: Some functionalities need to beimplemented in sub classes that extends the abstractclassStatement I & II are TRUECoreJava-Inheritance,Interfaces & AbstractClasses-ApplicationCarefully read the question and answer accordingly.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 130 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
N/A
Tags
following statements, JavaServer Pages

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture