java

JAVA array declaration and initialization

An array is group of variables that is given only one name. Each variable that makes up the array is given a number instead of a name which makes it easier to work with using loops among other things.

 

int[] a = new int[5];

int[] b = {12, 23, 34, 45, 56};

int[][] c = new int[3][3];
c[0][0] = 1;

int[] d = new int[5];
      d[0] = 12;
      d[1] = 23;
      d[2] = 34;
      d[3] = 45;
      d[4] = 56;

 

Exception handling and definitions Three Kinds of Exceptions

Definition:  An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions.

When an error occurs within a method, the method creates an object and hands it off to the runtime system. The object, called an exception object, contains information about the error, including its type and the state of the program when the error occurred. Creating an exception object and handing it to the runtime system is called throwing an exception.

 

Advantages of Object Oriented Programming

Some of the elements of OOP are:-

Inheritance:-
Inheritance is the process of deriving new classes from an existing base class.Here the derived classes not only inherits the capabilities of the base class but add refinement of its own.

 

Core Java programming(Core Java)

 Java is an object-oriented programming(OOps) language which was developed by Sun Microsystems. Java programs are platform independant which means they can be run on any operating system with any type of processor as long as the Java interpreter is available on that system.

 

Syndicate content