Core Java basics


Java is a high level and fully Object Oriented programming language. It is platform (Operating) system independent due to bytecode and JVM. It is compiler and intepreter based language. So "Compile once and run anywhere".


Operators are used to manipulate primitive data types. It is classified as unary, binary or ternary operators.
Following are different operators in Java :

  • Assignment
  • Arithmetic
  • Relational
  • Logical
  • Bitwise
  • Compound assignment
  • Conditional

Access Specifiers

In Java all members of a class must have an access specifier. It is used to implement Encapsulation technique of OOP (Object Oriented Programmaing). The purpose of access specifiers is to declare accessibility of members; means from where it is accessible.

Following access specifiers are available in Java :
  • private(keyword) - All private members can not access from out side of class.
  • default(Not keyword) - All default members are accessible in same package only.
  • protected(keyword) - All protected members are accessible in same package and derived classes in other package.
  • public(keyword) - It is accessible from anywhere.


Package is group of classes and Interfaces. It is used for namespace. All classes put into a package must reside in a directory with that package name.


Interface is a reference type, similar to a class and can contain constants and abstract method only.All members are public by default. An interface can extend another interface.A class can implement multiple interfaces.


A Thread is a control of flow statements in the program. It is used to allow multiple activities to execute simultaneously within a single process.It also referred as lightweight processes and every process has at least one thread - the main thread.


An exception is an abnormal event that occurs during program compilation and execution. It disrupts the normal flow of instructions.

The common situations that occur execution in program are:
  • Running out of memory
  • Resource allocation errors
  • Inability to find files
  • Problems in network connectivity
There are two types of exceptions
  • Checked - Compile-time errors
  • Unchecked - Run Time errors

Input and Output

Stream is an abstract representation of data connected to some input or output devices. It is used to write/read to/from external resources.Input Streams are used to read data from any data source like keyboard, socket, file and output Streams are used to write data to any data destination like console, socket, file.


A Collection is a group of object. The Collections Framework in Java, gives you lists, sets, maps, and queues to satisfy most of your coding needs.

There are a few basic operations you will normally use with collections:

  • Add objects to the collection.
  • Remove objects from the collection.
  • Find out if an object (or group of objects) is in the collection.
  • Retrieve an object from the collection (without removing it).
  • Iterate through the collection, looking at each element (object) one after another.


In Java, package is used to develop Server/Client application using socket technique. Socket is space to communicate to remote system.

It is two types :

  • Client Socket( : It is used to make client request to server on specific port.
  • Server Socket( : It runs on a particular port, which client used to make requests.