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
Which selection below lists two operating systems that include BitLocker? A. Windows XP Professional and Windows 7 Professional
Leona [35]
It will be the windows 8 professional
3 0
3 years ago
A private network that is accessible only to employees of the company that created it is called:
Trava [24]
Intranet is the answer to this question.

Google definition: An intranet is a network based on TCP/IP protocols (an internet) belonging to an organization, usually a corporation, accessible only by the organization's members, employees, or others with authorization.
6 0
3 years ago
what is the best book or website to learn mechanical machine design? . high detail ,easy to under stand .
Vadim26 [7]
WERE IS A B C D I CANT GIVE YOU ANSWER
7 0
3 years ago
Photographing during the midday can produce which of the following?
bija089 [108]

Answer:

great lighting

great emotion

great setting

great feeling

5 0
3 years ago
Which of the following statements is TRUE? C++ functions can return a value of type array if it is returned as a base address va
lesantik [10]

Answer:

The answer to this question is "C++ functions can't return array type value".

Explanation:

In C++ language the method is a collection of declarations executing a process together. It is a statement, that tells the compiler to return and accept parameters of a function. In C++, it includes many standardized functions, which can be called by the software, and other choices were wrong, which can be described as follows:

  • In c++ function can't return array type always.  
  • function is not address based.  
  • If array is local to function, but function will not return array value.
3 0
3 years ago
Other questions:
  • Each organization that provides host services on the public Internet is responsible for providing and maintaining DNS authoritat
    7·1 answer
  • What does % find on edhesive??
    14·1 answer
  • Constructors have the same name as the ____.1. data members2. member methods3. class4. package
    5·1 answer
  • Why would you use quotation marks in a search string when conducting an internet search?
    12·1 answer
  • Question 6 (1 point)
    15·1 answer
  • I Previous
    6·1 answer
  • Frrrrrrrrrrreeeeeeeeee brainliest for u
    13·2 answers
  • Besides your computer, where else can you find and use an operating system?
    11·1 answer
  • If you double the force of and object what happens to the acceleration
    10·1 answer
  • A good algorithm should have which three components?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!