Hi, in this blog let’s get started with java…. let’s skip its history and move to its concepts. Ultimate aim to develop java is to behave as a pure Object-Oriented language but unfortunately it is not. Because its supports primitive data types like int, float, etc., to overcome this JAVA has introduced wrapper class. I’ll tell u detail soon after.
The main building blogs of java program is Objects and Class with the help of these we can simulate any real-time object with its qualities as a JAVA program. In this blog I share my knowledge about the class.
Class, the class is a blue print or framework which contains variables and methods(functions) that define the quality of an object. The syntax of class is “class <name> {……….}”. for example
class box { //……………………………………………class name
int length = 10;
int breadth = 10;
String colour =” blue”;
String shape = “square”;
void print() { //………………………………………….method.
System.out.println(“This box is in “ +shape+” with “+blue” colour);
}
}
The class has different types assigned with a specific purpose or a feature. Singleton class, which has only one object it is achieved by making a constructor as a static one. Concrete class, the class has all definition these class has same syntax as a normal class. Wrapper class, in order to make java as a pure object-oriented language this class are introduced which contains logics that replace the primitive data types for example int a=10 also written as Integer a =new Integer (10), Integer is a wrapper class of int . The classes which introduced at beginning of java are called as legacy class and it is advised not to use due to lack of support.
There is a special class called Abstract class, which has a syntax” abstract class <name>{……..}”. we will talk about this in detail later.
In this blog I had mentioned some terms like constructor, abstract, static object which will be covered in my next topic. If you want to know java history go-to wiki...
For more blogs subscribe and comment your valuable comments below.....
Follow me @ facebook
Comments
Post a Comment