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 object oriented programming. Show all posts
Showing posts with label object oriented programming. Show all posts

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.

Explain about overloading in Java with Example l

2:36 AM
What is method overloading in Java Method overloading in Java is a programming concept when programmer declares two methods of the same name but with different method signature, e.g. change in the argument list or change in the type of argument. method overloading is a powerful Java programming technique to declare a method which does a similar performance but with a different kind of input. One of the most popular examples of method overloading is System.out.println() method which is overloaded to accept all kinds of data types in Java. You have println() method which takes String, int, float,double or even char in output. All of those methods are collectively referred as an overloaded method in Java. The difference between method overloading and overriding is also a popular Java interview question. In the next section, we will some important points about method overloading in Java and then a simple example of how to overload a method in Java. Properties of method overloading i...

Can we override static method in Java or what is Method Hiding in java with example

2:34 AM
Can we override static method in Java - which is also known as Method Hiding Can we override static method in Java No, you cannot override static method in Java because method overriding is based upon dynamic binding at runtime and static methods are bonded using static binding at compile time. Though you can declare a method with same name and method signature in the subclass which does look like you can override static method in Java but in reality that is method hiding. Java won't resolve method call at runtime and depending upon the type of Object which is used to call a static method, the corresponding method will be called. It means if you use Parent class's type to call a static method, original static will be called from a patent class, on their other hand if you use Child class's type to call a static method, the method from child class will be called. In short, you can not override static method in Java. If you use Java IDE like Eclipse or Netbeans, they wil...

What is method overloading in Java with Example

2:26 AM
What is method overloading in Java Method overloading in Java is a programming concept when programmer declares two methods of the same name but with different method signature, e.g. change in the argument list or change in the type of argument. method overloading is a powerful Java programming technique to declare a method which does a similar performance but with a different kind of input. One of the most popular examples of method overloading is System.out.println() method which is overloaded to accept all kinds of data types in Java. You have println() method which takes String, int, float,double or even char in output. All of those methods are collectively referred as an overloaded method in Java. The difference between method overloading and overriding is also a popular Java interview question. In next section, we will some important points about method overloading in Java and then a simple example of how to overload a method in Java. Properties of method overloading in ...

.