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
When developing an estimate, which of the following items is typically marked up with the highest percentage rate?
dmitriy555 [2]

Answer: D. Labor

Explanation:

8 0
1 year ago
Create a flowchart to print numbers from 1 to 100
Mkey [24]

Answer:

brainliest plsss

Explanation:

I think so this is what you had asked!!!!!!

hope it helps

4 0
3 years ago
Does anyone have code hs circle pyramid 2.0?
Andrews [41]

Answer:i dont

Explanation:

8 0
2 years ago
Write a function called is_present that takes in two parameters: an integer and a list of integers (NOTE that the first paramete
Agata [3.3K]

Answer:

The function in python is as follows

def is_present(num,list):

    stat = False

    if num in list:

         stat = True

       

    return bool(stat)

Explanation:

This defines the function

def is_present(num,list):

This initializes a boolean variable to false

    stat = False

If the integer number is present in the list

    if num in list:

This boolean variable is updated to true

         stat = True

This returns true or false        

    return bool(stat)

7 0
3 years ago
Write an expression that executes the loop while the user enters a number greater than or equal to 0. Note: These activities may
RoseWind [281]

Answer:

while ( num >= 0) { ... }

Explanation:

Required

Express to execute a while loop with the given condition.

The condition in the question is that: the user input must be greater than or equal to 0.

The statement for this is:

while ( num >= 0) { ... }

Where num is the input variable

8 0
2 years ago
Other questions:
  • How many spaces is equal to one tab on a keyboard? When I compose emails, the tab button doesn't indent for me, so how many time
    7·1 answer
  • If I Uninstall Nba 2k 19 from my ps4 will my career be gone forever?​
    5·2 answers
  • When I try to invite someone to be my friend on brainly, for some people, it says, "Somethings up. Invitation wasn't sent". Can
    8·1 answer
  • All states that have altered judicial selection techniques in recent years have adopted some form of:
    5·1 answer
  • What will the declaration below do to its target?
    9·1 answer
  • What keyword must be used on any method (function) on your class that is called from your main() method?
    15·1 answer
  • View which is used to specify the tables fields , their data types and properties ​
    9·2 answers
  • '|'/2`/ '|'[] |)[-([]|)[- '|'#!$
    9·1 answer
  • Please help I need help with web technology I forgot to post the question in the last one. here it is tho.
    9·1 answer
  • What do you think entertainment or gaming platforms will look like in the future?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!