Computer Science, asked by vida555, 1 year ago

Answer these questions in brief : ! Please don't spam !

1. define encapsulation? how is it implemented in Java ?
2. what is meant by data abstraction? how is it implemented in Java ?
3. what is the difference between methods print() and println()?
4. explain the fall through property of switch statement ?​

Answers

Answered by pallavisingh54
0

1.Encapsulation in Java is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class.

2.Data abstraction in java is the concept of creating complex data types and only selecting relevant operations to interact with that data type. Abstraction is a core component of object oriented programming Each OOP language has its own way of implementing abstraction.

3.Difference between the methods print() and println()

The println("...") method prints the string "..." and moves the cursor to a new line. The print("...") method instead prints just the string "...", but does not move the cursor to a new line. Hence, subsequent printing instructions will print on the same line.

4.Java fall through switch statements. ... When the variable being switched on is equal to a case, the statements following that case will execute until a break statement is reached. When a break statement is reached, the switch terminates, and the flow of control jumps to the next line following the switch statement

hope you like the answer

then follow me ..

Answered by DIAMONDQUEEN
2

Heyaa friend ! ☺

>> Here's your answer :

1. define encapsulation? how is it implemented in Java ?

  • Ans : Binding up of data and associated functions together into a single unit is called encapsulation. in Java it is implemented by the use of a class.

2. what is meant by data abstraction? how is it implemented in Java ?

  • Ans : The act of representing only essential features without including its background details is called abstraction. Data abstraction can also be defined as the process of hiding the implementation details and showing only the functionality.In Java it is implemented by the use of interfaces or by making the class abstract.

3.what is the difference between methods print() and println()?

  • Ans : The print() function prints a line and the control remains on the same line whereas, the println() function prints a line and control moves on to the next line.

4. explain the fall through property of switch statement ?

  • Ans : In the absence of break keyword after a case in a switch case construct the control falls to the next case. this property of switch statement is known as fall through.

___________________________

___________________________

Thank you ! ♠

Doubts are most welcome :)

Similar questions