
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
![Question 18
What is output?
public abstract class People {
protected String name;
protected int age;
public abstract void PrintInfo();
public void PrintInformation() {
System.out.println("In Base Class People");
}
}
public class Teacher extends People {
private int experience;
public void PrintInfo() {
System.out.println("In Child Class Teacher");
}
}
public class Principal extends Teacher {
public void PrintInformation() {
System.out.println("In Child Class Principal");
}
public static void main(String args[]) {
Principal tim;
tim = new Principal();
tim.PrintInfo();
}
}
Error: Compiler error
In Base Class People
In Child Class Teacher
O In Child Class Principal](https://content.bartleby.com/qna-images/question/5498129d-fa90-4054-9767-1cffe54599e5/657aacfa-fbab-409b-bf6f-fa285ab9d7e7/fvhktcq_thumbnail.jpeg)
Transcribed Image Text:Question 18
What is output?
public abstract class People {
protected String name;
protected int age;
public abstract void PrintInfo();
public void PrintInformation() {
System.out.println("In Base Class People");
}
}
public class Teacher extends People {
private int experience;
public void PrintInfo() {
System.out.println("In Child Class Teacher");
}
}
public class Principal extends Teacher {
public void PrintInformation() {
System.out.println("In Child Class Principal");
}
public static void main(String args[]) {
Principal tim;
tim = new Principal();
tim.PrintInfo();
}
}
Error: Compiler error
In Base Class People
In Child Class Teacher
O In Child Class Principal
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- UML for the following Code: public class ProductOrder { private int numBook = 0; private int numCD = 0; private int numDVD = 0; public ProductOrder(int numBook, int numCD, int numDVD){ this.numBook = numBook; this.numCD = numCD; this.numDVD = numDVD; } public int getBook(){ return numBook; } public void setBook(int numBook){ this.numBook = numBook; } public int getCD(){ return numCD; } public void setCD(int numCD){ this.numCD = numCD; } public int getDVD(){ return numDVD; } public void setDVD(int numDVD){ this.numDVD = numDVD; } public int getProductTotal(){ return getBook() + getCD() + getDVD(); } }arrow_forwarddefined the cat class in fullarrow_forwardQuestion 1 Consider: class Car { ? } public Car() { } What happens if you try to run new Car(); A new object is created A new class is created It does not run Nothing happensarrow_forward
- True or False A subclass can override methods from its superclass.arrow_forwardFind the error(s) in the following class definition: public class Circle private double radius; public double setRadius(double a) { radius = a; public void getRadius() { return radius;arrow_forwardCorrect and detailed answer will be Upvoted else downvoted. Thank you!arrow_forward
- Question p .Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this linearrow_forwardFind the error(s) in the following class definition: public class TestClass private int value1; private int value2; public void TestClass(int num1, int num2) { value1= num1; value2 = num2; }arrow_forwardclass Bug { private final int orgPosition = 0; private int currentPosition; private boolean direction; public Bug() { direction = true; currentPosition = orgPosition; } public void move() { if (direction) { ++currentPosition; } else { --currentPosition; } } public void turn() { direction = !direction; } public int getPosition() { return currentPosition; } public boolean getDirection() { return direction; } public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Position = " + currentPosition + ", Direction = "); sb.append(direction ? "RIGHT" : "LEFT"); return sb.toString(); } } -------------------------------------TestDriver.java------------------------------------- import java.util.Scanner; class TestDriver { public static void main(String args[]) { Scanner input = new Scanner(System.in); Bug b…arrow_forward
- Incorrect Question 4 Consider public class Species { } // fields private String name; private int population; private double growthRate; // constructor public Species () { } name = "No Name Yet"; population = 0; growthRate = 33.3; Which of the following is the best setter method for the population instance variable? public boolean setPopulation(int newPopulation) { } if (newPopulation>= 0) { } population = newPopulation; return false; } return true; public public void setPopulation (int newPopulation) if (newPopulation>= 0) { } population newPopulation; public void setPopulation (int newPopulation) { population } = newPopulation;arrow_forwardclass IndexItem { public: virtual int count() = 0; virtual void display()= 0; };class Book : public IndexItem { private: string title; string author; public: Book(string title, string author): title(title), author(author){} virtual int count(){ return 1; } virtual void display(){ /* YOU DO NOT NEED TO IMPLEMENT THIS FUNCTION */ } };class Category: public IndexItem { private: /* fill in the private member variables for the Category class below */ ? int count; public: Category(string name, string code): name(name), code(code){} /* Implement the count function below. Consider the use of the function as depicted in main() */ ? /* Implement the add function which fills the category with contents below. Consider the use of the function as depicted in main() */ ? virtualvoiddisplay(){ /* YOU DO NOT NEED TO IMPLEMENT THIS FUNCTION */ } };arrow_forwardmethode code below abstract class Method { // declaration of variables protected int input; protected String output; // Abstract methods public abstract boolean isHard(); public abstract String specificWay(); public abstract void Method(); public abstract void Method(int input, String output); // Getter methods for the input field public int getInput() { return this.input; } // Setter methods for the input field public void setInput(int input) { this.input = input; } // Getter methods for the output field public String getOutput() { return this.output; } // Setter methods for the output field public void setOutput(String output) { this.output = output; } // Custom string representation of the object public String toString() { return "Method"; }}arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education