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
Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
bagirrra123 [75]
The answer is the Kernel.
In computing, the Kernel's job is to manage the I/O requests from the software on your computer and converts them into data processing instructions for the CPU (Central Processing Unit) and the rest of the electronic components of a computer.
 
4 0
3 years ago
Preesure is drived quantity? why​
Marrrta [24]

Answer:

Basically, anything quantity that is not defined as one of the 7 base quantities is a derived quantity by definition. Pressure is not one of the 7 base quantities. Hence it is a derived quantity.

6 0
3 years ago
Read 2 more answers
Which command should you enter to configure a single port to discard inferior bpdus 200-125?
Airida [17]

Answer:

spanning-tree portfast bpduguard

Explanation:

spanning- tree protocol (STP) is a layer 2 protocol in the OSI model. It is automatically configured in a switch to prevent continual looping of BPDUs, to avoid traffic congestion. The fastport bpduguard is only applicable in non-trunking access in a switch. It is more secure to configure the fastport mode in switch port connected directly to a node, because there are still bpdus transfer in a switch to switch connection.

BPDUs Guard ensures that inferior bpdus are blocked, allowing STP to shut an access port in this regard.

8 0
3 years ago
Which of the following are the rows or columns of white space created between grids?
erma4kov [3.2K]
It would be margins. none of the others are even terms for anything.
4 0
3 years ago
How to get someone off your best friends list without blocking them
Paraphin [41]

Answer:

Which website

Explanation:

6 0
2 years ago
Other questions:
  • What type of document would you use the landscape page orientation
    7·1 answer
  • 2) Complete the get_num_of_characters() function, which returns the number of characters in the user's string. We encourage you
    11·1 answer
  • How has technology affected the way that you produce art like photographs?
    8·1 answer
  • Co to jest podprogram (procedura lub funkcja)? Zaznacz poprawną odpowiedź. a) Wielokrotne powtarzanie tych samych poleceń. b) Wy
    8·1 answer
  • A computer can sort x objects in t seconds, as modeled by the function below:
    5·1 answer
  • The page orientation in which the page width is greater than the page height is called
    8·1 answer
  • Celeste is writing a paper. However, two pages in, her computer shuts down unexpectedly. She never saved her paper, and all her
    12·2 answers
  • A-1 grdening supply is preparing a reprt to hand out to the customerez in pointes form only.why should the reprts writers avoid
    9·2 answers
  • Which of the following is not a data visualization technique?
    6·1 answer
  • It's generally best to use what types of sites for factual internet research? Select all that apply from the choices below.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!