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
7. In order to check your following distance, use a fixed object and count seconds.
rewona [7]

Answer:

False

Explanation:

7 0
3 years ago
Read 2 more answers
ANSWER THIS CORRECTLY FOR BRAINLIEST
jeka57 [31]
The answer is https it is on Every url
6 0
3 years ago
Read 2 more answers
Select the different network functions from the list below.
VashaNatasha [74]

Answer:

IP address

blocking spam

power

SAN

8 0
3 years ago
Q) Select the two obstacles for data parsing
fgiga [73]

Answer:

A and B

Explanation:

parsing with a rich grammar like TAG faces two main obstacles: low parsing speed and a lot of ambiguous syntactical parses.

3 0
4 years ago
Read 2 more answers
Lamp is an acronym for a complete solution of open source software that goes together to build a general purpose web server. whi
Westkost [7]
Answer choices?

LAMP contains <span>Linux, Apache, MySQL, and PHP.</span>
3 0
3 years ago
Other questions:
  • In the lab, you used the filter box in Wireshark to remove traffic from port 3389. What is that port used for? What filter synta
    12·1 answer
  • The keyboard preferences pane includes a list of keyboard shortcuts.
    8·1 answer
  • When a programmer creates an abstract data type, he or she can decide what values are acceptable for the data type, as well as w
    12·1 answer
  • When specifying keywords to conduct an internet search, which of the following parts of speech will be the most useful??
    6·1 answer
  • Juan copied and pasted information from a Word document
    8·1 answer
  • As related to the use of computers, ____ is defined as gaining unauthorized access or obtaining confidential information by taki
    10·1 answer
  • Can someone please give me Python test 3 it would help me tremendously
    5·1 answer
  • In a conditional statement, the______ symbol is used to separate a test expression from the expression to be processed if the te
    10·1 answer
  • These statements describe guidelines for the use of tables in presentations.
    9·2 answers
  • write a recursive function that accepts an integer argument, n. the function should display n lines of asterisks on the screen,
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!