Call Us at: 8056 966 366 / 9500 960 135
Mail us at: info@cloudcareersolutions.com

         INTRODUCTION   JAVA

             Java is a programming language created by James Gosling from Sun Microsystems (Sun) in 1991. The target of Java is to write a program once and then run this program on multiple operating systems. The first publicly available version of Java (Java 1.0) was released in 1995. Sun Microsystems was acquired by the Oracle Corporation in 2010. Oracle has now the steermanship for Java. In 2006 Sun started to make Java available under the General    Public License (GPL).

 JAVA VIRTUAL MACHINE:

                      The Java virtual machine (JVM) is a software implementation of a computer that executes programs like a real machine. Java virtual machine is written specifically for a specific operating system, e.g., for Linux a special implementation is required as well as for Windows.

DEVELOPMENT PROCESS IN JAVA:

Java source files are written as plain text documents. The programmer typically writes Java source code in an Integrated Development Environment (IDE) for programming.

Check installation

  •   The Java  must be available in your path environment You can test if the JRE is correctly installed via a console.
  • You can test if the JRE is correctly installed via a console. To open a console on Windows: Win+R, enter cmd and press Enter).
  • If the JRE is correctly installed, this commands prints information about your Java installation. In this case you can skip the Java installation description.

BEST JAVA LANGUAGE STRUCTURE

            CLASS:

                       A class is a template that describes the data and behavior associated with an instance of that class.

A class is defined by the class keyword and must start with a capital letter. The body of a class is surrounded java.

OBJECT:

                             An object is an instance of a class.

                  The object is the real element which has data and can perform actions. Each object is created based on the class definition. The class can be seen as the blueprint of an object, i.e., it describes how an object is created.

OBJECT AS SUPERCLASS:

                   Every object in Java implicitly extends the Object class. The class defines the following methods for every Java object:

  • equals(o1) allows checking if the current object is equal to o1
  • getClass() returns the class of the object
  • hashCode() returns an identifier of the current objecttoString() gives a string representation of the current object

INTERFACE IN JAVA:

                               An interfaces is a type similar to a class and is defined via the interfacekeyword. Interfaces are used to define common behavior of implementing classes. If two classes implement the same interface, other code which work on the interface level, can use objects of both classes.

Like a class an interface defines methods. Classes can implement one or several interfaces. A class which implements an interface must provide an implementation for all abstract methods defined in the interface.

If a class implements two interfaces and if these interfaces provide the same default method, Java resolves the correct method for the class by the following rules:

  • Superclass wins always against the superinterface – If a class can inherit a method from a superclass and a superinterface, the class inherits the superclass method. This is true for concrete and abstract superclass methods. This rule implies that default methods are not used if this method is also declared in the superclass chain.
  • Subtypes win over Supertypes – If a class can inherit a method from two interfaces, and one is a subtype of the other, the class inherts the method from the subtype.

Leave a Reply