JavaGian java tutorial and java interview question and answer

JavaGian , Free Online Tutorials, JavaGian provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core java, sql, python, php, c language etc. for beginners and professionals.

Showing posts with label Abstraction. Show all posts
Showing posts with label Abstraction. Show all posts

java abstraction with example

3:47 AM
abstraction  is the quality of dealing with ideas rather than events. For example, when you consider the case of e-mail, complex details such as what happens as soon as you send an e-mail, the protocol your e-mail server uses are hidden from the user. Therefore, to send an e-mail you just need to type the content, mention the address of the receiver, and click send. Likewise in Object-oriented programming, abstraction is a process of hiding the implementation details from the user, only the functionality will be provided to the user. In other words, the user will have the information on what the object does instead of how it does it. In Java, abstraction is achieved using Abstract classes and interfaces. Abstract Class A class which contains the  abstract  keyword in its declaration is known as abstract class. Abstract classes may or may not contain  abstract methods , i.e., methods without body ( public void get(); ) But, if a class has at least one abstract method, th

Difference between Abstraction and Encapsulation in Java-OOPS

2:41 AM
Abstraction vs Encapsulation in Java; Difference between Abstraction and Encapsulation in Java. Here are some of the main differences between Abstraction vs Encapsulation in Java and OOPS(Object Oriented programming) concept. Abstraction and Encapsulation along with Inheritance and polymorphism form basis of Object-oriented programming in Java. 1) First difference between Abstraction and Encapsulation is that, Abstraction is implemented in Java using interface and abstract class while Encapsulation is implemented using private, package-private and protected access modifier. 2) Encapsulation is also called data hiding. 3) Design principles "programming for interface than implementation" is based on abstraction and "encapsulate whatever changes" is based upon Encapsulation.

.