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
PilotLPTM [1.2K]
3 years ago
14

Create a class 'ProblemSolution' with following characteristics A public method 'solution' without parameters and return type is

int. Create object of class 'Student' inside 'solution' method and return the value of ""rollNumber"" from the class 'Student'.
Computers and Technology
1 answer:
Rus_ich [418]3 years ago
8 0

Answer:

The program to this question as follows:

Program:

class Student //defining class student

{

int rollNumber=1001; //defining integer variable rollnumber and assign value

int value() //defining method value

{

return rollNumber; //return value

}

}

public class ProblemSolution extends Student //defining class problemSolution that inherits Student

{

int solution() //defining method solution

{

Student stu=new Student(); //creating student class object

return stu.value(); //call function using return keyword  

}

public static void main(String ax[]) //defining main method

{

int result; //defining integer variable result

ProblemSolution ps=new ProblemSolution(); //creating class object

result=ps.solution(); //holding value of solution function

System.out.println("rollNumber value is: "+result); //print value

}

}

Output:

rollNumber value is: 1001

Explanation:

In the above java code two-class "Student and ProblemSolution" is defined, in which student class an integer variable rollNumber is defined, that holds a value "1001", and inside this class, a method "value" is defined, that return above variable value.

  • In the next step, class "ProblemSolution" is defined, that inherits the student class, inside this class two method "solution and the main method" is defined.
  • Inside the solution method, the student class object is created and this method uses the return keyword to call the student class method "value".
  • In the main method, an integer variable "result" is defined, which holds its method "solution" value and uses print function to print its value.
You might be interested in
What does the action tool allow you to do in Microsoft power point?
pickupchik [31]
I believe the answer is A. Add animation to clip art and text 
6 0
3 years ago
Fill up the blank:- The picture that graphically represents the items you use in Windows is called a/an .......
vagabundo [1.1K]
The picture that graphically represents the items you use in Windows or any other OS is called an Icon. An icon is a picture that represents the program that is being used. An icon is useful for the user's to directly know what type of program they need to use or such.
8 0
3 years ago
The producers of media messages want to get their information to?
alexandr1967 [171]
It is B        .............
6 0
3 years ago
Read 2 more answers
What does copyright and trademark both have in common
Marina CMI [18]

copyright is the exclusive legal right, given to an originator or an assignee to print, publish, perform, film, or record literary, artistic, or musical material, and to authorize others to do the same.  

trade mark is A trademark, trade mark, or trade-mark is a recognizable sign, design, or expression which identifies products or services of a particular source from those of others, although trademarks used to identify services are usually called service marks.

4 0
4 years ago
Need done ASAP
Amiraneli [1.4K]

The correct answer is A. A1!

7 0
3 years ago
Other questions:
  • Hiding an object, such as a diary, to prevent others from finding it is an example of:______________.
    10·1 answer
  • What is the name for the percentage of people who don't have jobs in a country or area?
    11·2 answers
  • Which option describes the purpose of configuring native supplicant profile on the cisco ise?
    7·1 answer
  • A web ______ is a computer that delivers requested webpages to your computer or mobile device.
    7·1 answer
  • What tab should you choose to locate the copy and paste tool?
    10·2 answers
  • Cell references in a formula are called _____.<br> a. assumptionsc. numbersb. valuesd. content
    11·1 answer
  • What are 2 main differences betweenarrays andstructs?
    7·1 answer
  • Suppose we want to adjust the page numbering for our Works Cited section so that it starts over at page 1. Is this possible to d
    12·2 answers
  • The time delay of a long-distance call can be determined by multiplying a small fixed constant by the number of communication li
    8·1 answer
  • ¿La tecnología ha esclavizado al hombre?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!