1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
artcher [175]
3 years ago
10

Which of the following class definitions is correct in Java?(i)public class Student{private String name;private double gpa;priva

te 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)
Computers and Technology
1 answer:
Soloha48 [4]3 years ago
4 0

Answer:

The answer is "Option 3".

Explanation:

In the given question the code (ii) is correct because in the class definition class "Student" defines a constructor that does not use any return type. and code (i) class definition the class "Student" defines a constructor that uses return type void which is not allowed in the constructor. and other options are not correct that can be described as follows:

  • In option 1, only code (ii) is correct.
  • In option 2, code (ii) is correct that's why it is not correct.
  • In option 4, it is not correct, because it uses void return type.

You might be interested in
Five aplications of ict​
Irina18 [472]

Answer:

MS Word, MS Excel, MS PowerPoint, Adobe Photoshop, Adobe Reader

Explanation:

8 0
4 years ago
What code would you use to create the login button?
Simora [160]

Go To This Web Page

https://www.w3schools.com/howto/howto_css_login_form.asp

5 0
3 years ago
What is the square root of 1600 and 36 ?​
liraira [26]

Answer:

1600 - 40

36 - 6

Explanation:

3 0
3 years ago
A selected graphic appears surrounded by a(n) ______, which has small squares and circles around its edges.
Elza [17]
Sizing handles :))))))))))
8 0
3 years ago
Which of the following is the BEST example of the principle of least privilege? Correct Answer: Wanda has been given access to t
pishuonlain [190]

Answer: Wanda has been given access to the files that she needs for her job.

Explanation:

The principle of least privilege is when a user is only given the minimum level of permissions that he or she needs to perform a particular job function. This helps in reducing the risk of attackers having access to data.

The best example of the principle of least privilege is Wanda has been given access to the files that she needs for her job. Given access to all of the file servers or access to all of the files on one server is incorrect.

7 0
3 years ago
Other questions:
  • A(n) ____ attack is when a system is compromised and used to attack other systems. a. indirect b. direct c. object d. subject
    13·1 answer
  • Which statement is a famous quote from Canadian Communications theorist Marshall mcluhan​
    9·1 answer
  • For which is a chart Legend used
    5·2 answers
  • 2. Which of the following fonts is most legible for a block of text? What font size and color would you choose if you were writi
    11·2 answers
  • Click this link to view O NET'S Wages and Employment section for Film and Video Editors.
    11·2 answers
  • What device connects a lan's switch to the next network? qizzlets?
    5·1 answer
  • Which of these is true about moores law
    6·1 answer
  • Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The input
    5·1 answer
  • What does input allow a computer to do
    14·1 answer
  • Evolution of management​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!