Answer Posted / venkat
'this' is used to reffer current class variable
for example
class sample
{
int myvar=10;
void mymethod()
{
int myvar=20;
system.outprintln("The value of myvar is"+myvar)
system.outprintln("The value of myvar is"+this.myvar)
}
}
output :
20,10
| Is This Answer Correct ? | 39 Yes | 15 No |
Post New Answer View All Answers
Why do while loop is used?
What is oops and its features?
What are the 3 pillars of oop?
What is inheritance in oop?
Can we have inheritance without polymorphism?
#include
Why we use classes in oop?
What type of loop is a for loop?
Explain the advantages of inheritance.
What are the 4 main oop principles?
What are two types of polymorphism?
What is encapsulation selenium?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
Why do we use encapsulation in oops?
What is encapsulation in simple terms?