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]
2 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]2 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 wireless device does the manager most likely have before being offered the upgrade by her supervisor?
uranmaximum [27]

Answer:

Smartphone

Explanation:

6 0
3 years ago
Read 2 more answers
While designing web pages for mobiles, the page content should be extensive such that the readers get the opportunity to explore
mixer [17]

Answer:

True

Explanation:

The readers need to know the aspects of the topic that will broaden their knowledge and idea. So when designing a web page it is very good to provide extensive content such as hyperlinks to related articles on the same topic. To broaden their reading scope.

However this should be done cautiously, not to provide facets that will end up distracting the importance and the core aspect of the main topic.

3 0
3 years ago
Read 2 more answers
Which source would provide the best way to find valid information about climate change
igor_vitrenko [27]
Primary sources would be best
4 0
2 years ago
Class 10 computer unit 1 all excersise​
kenny6666 [7]
Y’all just asking for people do your work, literally not even a question
5 0
2 years ago
A customer survey asked respondents to indicate their highest levels of education. The only three choices in the survey were hig
solong [7]

Answer:

27%

Explanation:

100% = 26% + 47% + x%

100% = 73% + x%

27% = x%

4 0
3 years ago
Other questions:
  • Mike wants to build an amplifier. Which technology can he use?
    15·1 answer
  • For some brand-name computers, the hard drive contains a partition that can be used to reinstall windows. what is the name for t
    6·1 answer
  • Why is it more important now than ever before to know how to evaluate websites and other online sources of information?
    7·1 answer
  • In which situation will file compression be required to complete the task
    15·1 answer
  • What does the rule of five say?
    12·2 answers
  • In a typical e-mail address, what is the "host"? A. an account designated by a user name. B. the computer that houses an Interne
    7·1 answer
  • Kyle asked his supervisor which type of computing model was used when the enterprise first started. She explained that the organ
    14·1 answer
  • My friend has a battery of 9000mah and loses 10 every day how many days well it take to go to zero
    13·1 answer
  • What will you see on the next line?<br> &gt;&gt;&gt;int(12.8)<br> ___
    15·1 answer
  • What are the features of the title bar for the Microsoft word application?​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!