How to open a program like notepad, pdf file using Java?

Java program to open any program or file. Example(s) – 1. Open notepad program using java. 2. Open a pdf file using java. This example will open a notepad for you. 1. Simple.java

This is a sample example to open a pdf file using java. To do so you just need to write some […]

Continue Reading

Interface in Java

multiple inheritance using interface

This post explains Interface in java. What is Interface? Interface is a blue print of class. Unlike class it contains only public & abstract methods and public, static & final fields. Interface Syntax:

Example:

  Difference between Interface and Class 1. Interface: Have only abstract methods Class: Cannot have abstract method 2. Interface: […]

Continue Reading

Loose coupling example using Interface

loose coupling

Loose coupling example using Interface Loose coupling has advantage over tight coupling. Lets understand it with example In below example we have two classes A and B Class B implements Interface i.e. InterfaceClass. InterfaceClass defines a Contract for B class as InterfaceClass have abstract methods of B class that can be access by any other […]

Continue Reading

Multiple Inheritance In Java

Multiple Inheritance in Java has always been a topic of debate among people. Based on the Oracle’s Java tutorial (http://docs.oracle.com/javase/tutorial/java/concepts/inheritance.html) inheritance is a concept reserved to classes only, not Interfaces, as what is inherited is the state and behavior which interfaces don’t have. So, java does not support multiple inheritance but this questions can be […]

Continue Reading