58. How many finalizers can a class have? - a. C. 2 d. Any number b. 1 59. Which of the following words indicates an object's reference to itself? - this c. public d. protected a. b. that
Q: 1) Which of the following variables can an inner class access from the class that encapsulates it?…
A: In this question, it is asked which of the following variables can inner class access from a class…
Q: A) There are four states in a class Pen. These states are "color" of type String, "ink" of color…
A: Note - According to our guidelines we are authorized to answer only one question at a time if you…
Q: Write a class called Circle with the required constructor and methods to get the following output.…
A: Create a class called circle and initialize the values to the data members of the class using the…
Q: Fill in the CODE (Answer) or the bolded Answer word. A class BankAccount with the following data…
A: String name, String acctNum, and double balance are data members of the BankAccount type. It…
Q: Question 3 (students need to only write justifications) Connascence Here is a simplified class…
A: In the above given code after execution of send(), setcc() is happening It is wrong because…
Q: Consider the class Students declaration and its constructor has two arguments (the data type of the…
A: Syntax for creating object of class. Classname object= new classname(parameters);
Q: These two pictures are my resource and driver classes. Please, help me with the error in my resource…
A: Formula to calculate the new salary using the percentage raise on salary: salary…
Q: This is the question: In Chapter 4, you created a class named Game that included two Team objects…
A: File name: “Team.java” public class Team{ //Declare instance variables private String…
Q: . Define a class named Book that represents a book about Java Programming Language, and it contains:…
A: Here, I have to write a java program to the above question.
Q: Doggie Day Care Given the TestDog class below, write a Dog class that will pass the tests contained…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: Given the class definitions above, what is printed to the console when the following lines of code…
A: Given Code is using Inheritance in Java Inheritance: Classes have the capability to Derive…
Q: 1. Write the different class names with class keyword 2. Write the different methods using public…
A: // consider class name booksclass Books { public int bookId; private int bookLocation; // getter for…
Q: or more objects may be created from a(n) A. method B.
A: Here have to determine correct option for one or more object.
Q: Refer to the following class for the question below: public class First{ public int num = 1; what…
A: Task : Given the partial java code. The task is to find the output of code if the code is correct.
Q: a. create a class called Student that has four instance variables -a (String) name, a (long)…
A: Hi there, Please find your solution below, I hope you would find my solution useful. Thank You!
Q: 11. Suppose your program contains the following class definition: class myClass ( public:…
A: Your answer is given below with proper explanation.
Q: It is possible for a class to have more than one constructor. A) This is correct. B) The answer is…
A: Task :- Choose the correct option for given statement about constructors.
Q: 2. If you have the following two methods in a class, will the code compile? public int getMileage…
A: The question has been answered in step2
Q: What is the output of the following code? public class MyClass { static int num = 20; private String…
A: static variables are the common shared instances among all the classes public static void main…
Q: Which casting among the following is allowed for the code given below? class A { public :int a;…
A: Question. Which casting among the following is allowed for the code given below? class A{public…
Q: different packages, while in the previous were in the same package. package package_02; public class…
A: 2.1). , the output will be "1" As the other variables y and z will not be visible in the class A as…
Q: 1. If you have the following two methods in a class, will the code compile? public int getMileage…
A: Answer: Option A: No
Q: 13 Type the correct answer in the box. Spell the words correctly. How can you create a class without…
A: Objective: Here, we need to state the term that will be fitted in the blank position of the given…
Q: what does the following mean? class A: private B
A: We are going to discuss the meaning of the given line in C++.
Q: 1. Implement the class bill: a. Write the constructor that takes as parameters all data fields…
A: the code is an given below : public class Bill { // private mmeners private String…
Q: consider the following code snippet: class A{ public: A0{ class B: private A{ B); }; main0{ B *b =…
A: Definition: Constructor: It is an object oriented programming language that is based on the…
Q: hen: 1) Add a public class constant which set the maximum area to 40.0 2) Add another constructor…
A: Algorithm: Start Create a class Room with attributes WindowNum,length,width Initialize a constant…
Q: ✓ Out of the following class declarations which one is/are invalid? (i) Class A { int x; }; (ii)…
A: Classes are an important concept of object-oriented programming. They are the way using which other…
Q: Assume we have a class called Animals and within this class we have a method called toString(), and…
A: Calling an Object's Methods. You also use an object reference to invoke an object's…
Q: (i) Class A { int x; }; (ii) Class B { } (iii) Public class A { } (iv) Object A { int x; };
A: As we know while creating any class its basic syntax is : Class A { private: int y;…
Q: When you redefine the __str__ method in a class, the keyword print has different meanings based on…
A: Source Code: class MyClass: x = 1 y = "" def __init__(self, Number, anyString):…
Q: What is wrong with the following programs? (a) 1 class A:2 # Construct an object of the class3 def…
A: Step 1:- a) Program:- class A:# Construct an object of the classdef A(self): radius = 3
Q: There are two objects- $product1 = new Shop(); $product2 = new Shop(); Which one of the following…
A: Question. There are two objects- $product1 = new Shop(); $product2 = new Shop(); Which one of the…
Q: 2. Suppose class called Student that defines three instance variables: name (string), age (integer),…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Car[] cars=new Car[]{new Car(), new Car("BMW")}; Based on the above statement, there are two…
A: The given line of code, Car[] cars = new Car[]{new Car(), new Car("BMW")}; is correct. But the given…
Q: 3.1- Which statement(s) are true? Choose all that apply. a. This code prints "123" to the output. b.…
A: Firstly, when access specifier is not mentioned, in java it will consider as some default specifier…
Q: Write the following Book class:A Book has-a title, ISBN number, author and price.o Include the…
A: All the lines inside this (/* */) field are comments of this program. Read all comments above the…
Q: 23) Which of the following is true about the class Q? a) it has no parent class b) it’s parent class…
A: Given that, Which of the following is true about the class Q?a) it has no parent classb) it’s…
Q: ?Which the following is not correct for the class defined class student{ int student(){}} class…
A: Note: Answering the first question as per the guidelines. In the given question, the class student…
Q: In example B are the classes that scott teaches referring the same object as the classes…
A: Yes is correct answer
Q: Public class secret private int x; private static int y; public static int count; public int z;…
A: Dear learner, hope you are doing well, I will try my best to answer this question. Thank You!!
Q: Please include doctring, and write only in python: First, write a class named Movie that has four…
A: A class is a group of objects which have common properties. An object is an instance of a class. It…
Q: B1. Answer the following questions: a. Given: class A { class Cextends B { public String toString()…
A: Please find the program and output in the below steps.
Q: What does it mean to use the keyword enum? when using this in a class (OOP)?
A: Enum is a collection of values a variable can take
Q: Which casting among the following is allowed for the code given below? class A { public :int…
A: Question. Which casting among the following is allowed for the code given below? class A {…
Q: 8- Create an instance of the following class and call its methods class Exam( int grade; public:…
A: Note:- Please mention programming language name . This is done in java. With the help of instance…
Q: public class A{ private int a; public A (int a) { a= a; public class B extends A{ public B (int a) {…
A: The given code is in Java Language: public class A{ private int a; public A(int a){…
Q: X Whether the following statement is TRUE or FALSE? The classes declared inside a package are called…
A: As the name suggests local classes are those classes that are defined in a block, which is a group…
Q: Given a programmer-defined class called Person, what is output? Person barb = new Person(18); Person…
A: getter is used to return the values in main function after performing operation and setter is used…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Trace through the following program and show the output. Show your work for partial credit. public class Employee { private static int empID = 1111l; private String name , position; double salary; public Employee(String name) { empID ++; this.name 3 пате; } public Employee(Employee obj) { empID = obj.empĪD; пате %3D оbj.naте; position = obj.position; %3D public void empPosition(String empPosition) {position = empPosition;} public void empSalary(double empSalary) { salary = empSalary;} public String toString() { return name + " "+empID + " "+ position +" $"+salary; public void setName(String empName){ name = empName;} public static void main(String args[]) { Employee empOne = new Employee("James Smith"), empTwo; %3D empOne.empPosition("Senior Software Engineer"); етрOпе.етpSalary(1000); System.out.println(empOne); еmpTwo empTwo.empPosition("CEO"); System.out.println(empOne); System.out.println(empTwo); %3D етpОпе empOne ;For the following four classes, choose the correct relationship between each pair. public class Room ( private String m type; private double m area; // "Bedroom", "Dining room", etc. // in square feet public Room (String type, double area) m type type; m area = area; public class Person { private String m name; private int m age; public Person (String name, int age) m name = name; m age = age; public class LivingSSpace ( private String m address; private Room[] m rooms; private Person[] m occupants; private int m countRooms; private int m countoccupants; public LivingSpace (String address, int numRooms, int numoccupants) m address = address; new int [numRooms]; = new int [numOceupants]; m rooms %3D D occupants m countRooms = m countOccupants = 0; public void addRoom (String type, double area)public class Stadium extends baseStadium{ public int typeTicket; int floors; int seating; String type; public float ticketPrice; public String leagueName=""; public void SetTecketName(String val) { leagueName=val; } public void setType() { if (typeTicket == 1) { type = "VIP"; } else { type = "Regular"; } } public String getType() { return type; } public void setPrice() { if (typeTicket == 1) { ticketPrice = 250; } else { ticketPrice = 100; } } public void setFloors(int floors) { this.floors = floors; } public int getFloors() { return floors; } public void setSeating(int seating) { this.seating = seating; } public int getSeating() { return seating; } public void printDetails() { System.out.println("Ticket Details:"); System.out.println("Ticket Type:…
- Public classTestMain { public static void main(String [ ] args) { Car myCar1, myCar2; Electric Car myElec1, myElec2; myCar1 = new Car( ); myCar2 = new Car("Ford", 1200, "Green"); myElec1 = new ElectricCar( ); myElec2 = new ElectricCar(15); } }class Player { protected: string name; double weight; double height; public: Player(string n, double w, double h) { name = n; weight = w; height = h; } string getName() const { return name; } virtual void printStats() const = 0; }; class BasketballPlayer : public Player { private: int fieldgoals; int attempts; public: BasketballPlayer(string n, double w, double h, int fg, int a) : Player(n, w, h) { fieldgoals = fg; attempts = a; } void printStats() const { cout << name << endl; cout << "Weight: " << weight; cout << " Height: " << height << endl; cout << "FG: " << fieldgoals; cout << " attempts: " << attempts; cout << " Pct: " << (double) fieldgoals / attempts << endl; } }; a. What does = 0 after function printStats() do? b. Would the following line in main() compile: Player p; -- why or why not? c. Could…interface StudentsADT{void admissions();void discharge();void transfers(); }public class Course{String cname;int cno;int credits;public Course(){System.out.println("\nDEFAULT constructor called");}public Course(String c){System.out.println("\noverloaded constructor called");cname=c;}public Course(Course ch){System.out.println("\nCopy constructor called");cname=ch;}void setCourseName(String ch){cname=ch;System.out.println("\n"+cname);}void setSelectionNumber(int cno1){cno=cno1;System.out.println("\n"+cno);}void setNumberOfCredits(int cdit){credits=cdit;System.out.println("\n"+credits);}void setLink(){System.out.println("\nset link");}String getCourseName(){System.out.println("\n"+cname);}int getSelectionNumber(){System.out.println("\n"+cno);}int getNumberOfCredits(){System.out.println("\n"+credits); }void getLink(){System.out.println("\ninside get link");}} public class Students{String sname;int cno;int credits;int maxno;public Students(){System.out.println("\nDEFAULT constructor…
- class Student { private int age = 18; public Student() { age = 19; } } public class Test { public static void main (String[] args){ Student s = new Student(); System.out.println (s.age); } }5 points Save Answer QUESTION 4 What is printed? public class Puppy { private int puppyAge; private String puppyName; Puppy(String name){ puppyName = name ;} public void setAge( int age ) { puppyAge = ++age; } public int getAge(){ return puppyAge; } %3D public class TestPuppy{ public static void main(String []args) { Puppy myPuppy = new Puppy( "tommy" ); myPuppy.setAge( 2 ); System.out.print("Puppy's age is :" + myPuppy.getAge()); System.out.print(" %3D Name chosen is :" + myPuppy.puppyNname ); D Puppy's age is : 2 Name chosen is : tommy Puppy's age is : 3 Name chosen is : tommy O Syntax Error O Run Time Error Save All Answers Close Window Save and Submit - Save and Submit to save and submit. Click Save All Answers to save all answers. MacBook Pro 888 ES F6 F3 96 7class Vehicle{String s = "This is my vehicle" ;}class Car extends Vehicle{String s = "This is my car" ;{System.out.println( super .s);}} class Truck extends Car{String s = "This is my truck" ;{System.out.println( super .s);}}public class MainClass{public static void main(String[] args){Truck t = new Truck ();System.out.println(t.s);}}
- class Base { public: int x, y: public: Base(int i, int j) { x = i; y = j; }}; class Derived : public Base public: Derived (int i, int j) { x = i; y = j; void display() {cout « x <<" "<< y; }}; int main(void) { Derived d(5, 5); d.display(); return e; Error O X=5,Y=5 X-0,Y=0 None of the above Other:Question 6 Consider: class Bike { } private String color; public Bike() { } public Bike(String newColor) { color = newColor; } public Bike (Bike bike) { color = } bike.color; public String getColor() { } } return color; public void setColor(String newColor) { color = newColor; Bike bike1= new Bike(); = Bike bike2 new Bike("blue"); Bike bike3 = new Bike(bike2); bike2.setColor("green"); Bike bike4 = new Bike(bike2); Which of the following are correct? bike4.getColor() returns null bike4.getColor() return "blue" bike3.getColor() return "green" bike2.getColor() returns "blue" bike4.getColor() return "green" bike1.getColor() returns bike3.getColor() return null bike3.getColor() returns "blue" bike2.getColor() returns "green" bike1.getColor() returns nullplease