subject

Which of the following class definitions is correct in java? (i)public class student{private string name; private double gpa; private int id; public void student(){name = ""; gpa = 0; id = 0; }public void student(string s, double g, int i){set(s, g, i); }public void set(string s, double g, int i){name = s; gpa = g; id = i; }public void print(){system. out. println(name + " " + id + " " + gpa); }}(ii)public class student{private string name; private double gpa; private int id; public student(){name = ""; gpa = 0; id = 0; }public student(string s, double g, int i){set(s, g, i); }public void set(string s, double g, int i){name = s; gpa = g; id = i; }public void print(){system. out. println(name + " " + id + " " + gpa); }}1. both (i) and (ii)2. none of these3. only (ii)4. only (i)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
Define a function printfeetinchshort, with int parameters numfeet and numinches, that prints using ' and " shorthand. ex: printfeetinchshort(5, 8) prints: 5' 8"
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
George heard about the benefits of a data warehouse. he wants to try implementing one for his organization. however, he is afraid that transferring data to the data warehouse will affect transaction time. which element ensures that transactions are not affected when moving data to a warehouse? when data is transferred to a data warehouse, the a area frees the source system to continue transaction processing.
Answers: 2
question
Computers and Technology, 25.06.2019 07:30
Which behavior demonstrates teamwork
Answers: 1
question
Computers and Technology, 25.06.2019 14:00
What are the two parts of a cell reference? a. column intersection and row rangeb. column range and row intersectionc. column letter and row numberd. column number and row letter
Answers: 1
You know the right answer?
Which of the following class definitions is correct in java? (i)public class student{private string...
Questions
question
Mathematics, 08.03.2021 20:10
question
Mathematics, 08.03.2021 20:10
question
Mathematics, 08.03.2021 20:10
Questions on the website: 13722359