What is OOP’s and define its basic concept in java? [ ICSE 2010 ]

  • OOP’s stands for Object Oriented Programming system.
  • It is a programming paradigms based on object to communicate data member and function together.
  • object, class, polymorphism, inheritance, data abastraction, encapsulation are some features of object oriented programming.

What is a class and how it is declared ?

  • A class is a blueprint and basic concept of object oriented programming.
  • It is also referred to as an instance of a class.
  • It is also a collection of data member and member function.
  • Declaration of a class: class is declared with the class keyword followed by class_name and enclosed within opening { and closing } curly braces.

Give example of primitive data type and composite data type in java ?

Primitive data type: boolean, char, byte, short, int, long, float, double

Composite data type: class, array, interface.

Why java uses Unicode character system ?

  • Unicode character system is used by Java programming language to implement Universal Coding Standards around the world.
  • Earlier only 128 character set were used to represent different characters and was difficult to corresponds different letters using different programming standards.
  • Today, Unicode system defines more than 128,000 characters to support English character, number, punctuation, etc. so that a uniform coding standard should be maintained.
  • In java ‘char’ data type occupy 2 bytes whose lowest default value is ‘/u0000’ and highest value is represented as ‘/uFFFF’

Differentiate between Primitive and Reference data types ?

The following are the differences between Primitive and Reference data types
Primitive data type Reference data type
1. It always have a some value and never be a null. 1. It can be null which denotes absence of any value./td>
2. It contains the actual value. 2. It contains the address of the data.
3. Only one value can be stored. 3. Multiple value can be stored.
4.Have fixed length in memory. 4.It can have different length in memory.
5.Example: char,int,float,double,etc. 5.Example: String,Array,class,etc.

Differentiate between == and .equals() ?

The following are the differences between == and .equals()
== .equals()
1. It is used to compare the values of any variable. 1. It is used to compare the values of any objects.
2. It is used to check the memory address in non-primitive data type. 2. It does not work with primitive data type in any way.
3. Example:
class Sample { `
public static void main(String args[]) {
int a=10;
int b=20;
if(a==b)
System.out.println(“Equal”);
else
System.out.pritln(“Not equal”);
}
}
Output: Equal
3. Example:
class Sample { `
public static void main(String args[]) {
String a=”Hello”; // here a is an object
String b=”Hello”;
if(a.equals(b))
System.out.println(“Equal”);
else
System.out.pritln(“Not equal”);
}
}
Output: Equal