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
NikAS [45]
3 years ago
7

g If a class named Student has a data member named gpa , and one of its member functions has a parameter also named gpa , how ca

n you refer to the data member inside that member function
Computers and Technology
1 answer:
victus00 [196]3 years ago
5 0

Answer:

By using the this keyword

Explanation:

The this keyword in java is used for pointing the current object or current variable .The this keyword is removing the ambiguity among the characteristics of the class as well as the variables with the similar name.

In the given question if the class student has member variable gpa also we have a method having the argument gpa with the help of this keyword we can refer the gpa variable inside the method .

Following are the implementation of the given question

public class Main // main class

{

 int gpa; // variable declaration

 public Main(int gpa) // constructor

 {

   this.gpa = gpa; // this keyword

 }

 public static void main(String[] args) // Main method

 {

   Main m= new Main(55); // creating object of class

   System.out.println("The Value of gpa is : " + m.gpa); // display value

 }

}

Output:

The Value of gpa is :55

You might be interested in
In the language of the World Wide Web, "this page cannot be displayed" means A. your computer's software is damaged. B. the ISP
asambeis [7]
The answer is d. most definitely <span />
7 0
3 years ago
Read 2 more answers
What is master slide and tell about master slide
Elan Coil [88]

The Master Slide is the design template or design theme used for the slides within your presentation. There are three different master slides—notes master, handout master, and the most common, the slide master. All are located under View > Master.

5 0
3 years ago
All queries have an explicit location. true of false
astraxan [27]
This statement is false

7 0
3 years ago
Read 2 more answers
When compared to traditional desktop customers, why are mobile phone users much more likely to book a room or airline reservatio
Gnesinka [82]
With mobile phone you can access data/internet wherever reception/coverage whereas desktop users cannot
4 0
3 years ago
Which of the following is the best name for a history report about world war 1
kolezko [41]

Answer: "World War-1: The War that Changed the Nation"

8 0
3 years ago
Other questions:
  • Which of the following is NOT a common GUI component? O a. Label b. Button c. Key press d. Text box
    12·2 answers
  • 3. Which of the following statements is true of a time management plan? 35 POINTS
    9·2 answers
  • What is TRUE about the following array?
    15·1 answer
  • What will the following program display?
    15·1 answer
  • Identify at least five different Information Technology careers that you could pursue in your home state, and choose the three t
    10·2 answers
  • Short Essay on the history of Computer​
    6·2 answers
  • Choose the best type of loop for each situation.
    6·1 answer
  • Java !!!
    10·1 answer
  • One student will be stationed near you in a coffee shop. The other student will be located two miles away from your school. You
    10·2 answers
  • What is the core function of an enterprise platform
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!