Knowee
Questions
Features
Study Tools

public class Person { }public class Student extends Person { }public class Teacher extends Person { }public class Room { }public class Classroom extends Room { }public class Office extends Room { }public class Hallway extends Room { }public class MainClass { private static ArrayList<Room> layout = new ArrayList<Room>(); public static void main(String[] args) { /* MISSING CODE */ }}

Question

public class Person { }public class Student extends Person { }public class Teacher extends Person { }public class Room { }public class Classroom extends Room { }public class Office extends Room { }public class Hallway extends Room { }public class MainClass { private static ArrayList<Room> layout = new ArrayList<Room>(); public static void main(String[] args) { /* MISSING CODE */ }}

🧐 Not the exact question you are looking for?Go ask a question

Solution

It seems like you want me to fill in the missing code in your Java program. However, you didn't specify what the missing code should do. Could you please provide more details?

Similar Questions

Main.java:3: error: class Person is public, should be declared in a file named Person.javapublic class Person { ^Main.java:15: error: class Student is public, should be declared in a file named Student.javapublic class Student extends Person { ^Main.java:24: error: class Employee is public, should be declared in a file named Employee.javapublic class Employee extends Person { ^Main.java:34: error: class Faculty is public, should be declared in a file named Faculty.javapublic class Faculty extends Employee { ^Main.java:44: error: class Staff is public, should be declared in a file named Staff.javapublic class Staff extends Employee { ^5 errors

Given the following code, find the compile error. Please select all that apply. public class Test {   public static void main(String[] args) {     m(new GraduateStudent());     m(new Student());     m(new Person());     m(new Object());   }   public static void m(Student x) {     System.out.println(x.toString());   } }  class GraduateStudent extends Student { } class Student extends Person {   @Override   public String toString() {     return "Student";   } } class Person extends Object {   @Override   public String toString() {     return "Person";   } } Group of answer choicesm(new GraduateStudent()) causes an errorm(new Student()) causes an errorm(new Person()) causes an errorm(new Object()) causes an error

what is the result of the following piece of code:public class Person{ public void talk(){ System.out.print("I am a Person"); }}public class Student extends Person{ public void talk(){ System.out.print("I am a Student"); }}public class Test{ public static void main(String args[]){ Person p = new Student(); p.talk(); }}I am a Person I am a Student I am a Person I am a StudentI am a Student I am a Person

class FourWheeler{    public FourWheeler()    {        System.out.println("Class FourWheeler");    }}class Car extends FourWheeler{    public Car()     {        System.out.println("Class Car");        }}class Audi extends Car{   public Audi()    {        super();        System.out.println("Class Audi");    }}class Driver{    public static void main(String args[])    {        Audi cc=new Audi();    }}

public class Employee { public int id; public String name; private int sal; public Employee(int id, String name , int sal) { this.id = id; this.name = name; this.sal = sal; } public void setSal(int sal) { this.sal = sal; } public int getSal() { return sal; } public static List<Employee> getEmpList() { List<Employee> list = new ArrayList<>(); list.add(new Employee(111, "A", 2000)); list.add(new Employee(222, "B", 3000)); list.add(new Employee(333, "C", 4000)); list.add(new Employee(444, "D", 5000)); return list; }}public class Appp { public static void main(String[] args) { List<Employee> list = Employee.getEmpList(); for(Employee e : list) { //line 1 e.setSal(e.getSal()*2); //line 2 } //line 3 }}Choose the appropriate option to replace code line 1 to 3 to get the same output from the program. listEmployees.forEach(e -> e.setSal(e.getSal()*2));for(Employee e : listEmployees) {e -> e.setSal(e.getSal()*2);}for(Employee e : listEmployees) {forEach(e -> e.setSal(e.getSal()*2));}for(Employee e : listEmployees) {e.forEach() -> e.setSal(e.getSal()*2);}SubmitPowered by Infosys Wingspan

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.