What is Class in Java
               Programming


http://javarevisited.blogspot.com
What is Class in Java
• Are you familiar with date types like int, long,
  float?
• If Yes, than what is the limitation of these
  data types?
• You got it right, they can only hold one type
  of data, i.e an int can only store integer
  values, a float can only store floating point
  values.
What is Class in Java
• Then question comes, how do we
  represent user defined types e.g.
  Person which can have a String name, a
  long phone number and an int age
• Class in Java is way to go.
• Class in Java is used to create user
  defined types.
What is Class in Java
• Benefit of user defined type is that it
  can combine and store multiple type and
  gives you power to create a user
  defined type for anything which exists
  in real world.
• You can divide them into two category.
• JDK or System classes and Application
  Classes
What is Class in Java
• JDK Classes are those which comes
  along with JDK e.g. java.lang.String,
  java.lang.Thread
• Application classes are those which you
  create in your Java program or
  application e.g. Person, Student etc
• Class in Java is created using class
  keyword
What is Class in Java
Here is an example of user defined class
class Person{
    int age;
    String name;
    long phone;


    public void int getAge(){
      return age;
    }
}
What is Class in Java
• Except holding code for variables e.g.
  age, name and phone and methods e.g.
  getName(), class doesn’t do any thing.
• Real magic starts when you create
  object of class.
• For example every single person e.g.
  you, me and your friend are object of
  Person, they have different name, age
  and phone number but they are Person
What is Class in Java
• Object are actual thing which is created
  from blueprint called class.
• Just like every car including BMW,
  Merc and Audy has blueprint and follow
  specification, every object follows
  structure defined in class.
• We learn more about object in Java in
  our next presentation.
What is Class in Java
• In Summary you can say a Class in Java
  is
  – A user defined type
  – A way to combine multiple data types into
    one
  – A blueprint to create object
  – A structure to hold variables and methods
    together
Related Articles and Post
• For more details on Class and Object in
  Java, See :

• What is Class in Java programming language

• What is Object in Java programming language

• Website: http://javarevisited.blogspot.com /
LIKED IT?




Tweet this presentation   Share this on Facebook

What is Class in Java and Object Oriented Programming

  • 1.
    What is Classin Java Programming http://javarevisited.blogspot.com
  • 2.
    What is Classin Java • Are you familiar with date types like int, long, float? • If Yes, than what is the limitation of these data types? • You got it right, they can only hold one type of data, i.e an int can only store integer values, a float can only store floating point values.
  • 3.
    What is Classin Java • Then question comes, how do we represent user defined types e.g. Person which can have a String name, a long phone number and an int age • Class in Java is way to go. • Class in Java is used to create user defined types.
  • 4.
    What is Classin Java • Benefit of user defined type is that it can combine and store multiple type and gives you power to create a user defined type for anything which exists in real world. • You can divide them into two category. • JDK or System classes and Application Classes
  • 5.
    What is Classin Java • JDK Classes are those which comes along with JDK e.g. java.lang.String, java.lang.Thread • Application classes are those which you create in your Java program or application e.g. Person, Student etc • Class in Java is created using class keyword
  • 6.
    What is Classin Java Here is an example of user defined class class Person{ int age; String name; long phone; public void int getAge(){ return age; } }
  • 7.
    What is Classin Java • Except holding code for variables e.g. age, name and phone and methods e.g. getName(), class doesn’t do any thing. • Real magic starts when you create object of class. • For example every single person e.g. you, me and your friend are object of Person, they have different name, age and phone number but they are Person
  • 8.
    What is Classin Java • Object are actual thing which is created from blueprint called class. • Just like every car including BMW, Merc and Audy has blueprint and follow specification, every object follows structure defined in class. • We learn more about object in Java in our next presentation.
  • 9.
    What is Classin Java • In Summary you can say a Class in Java is – A user defined type – A way to combine multiple data types into one – A blueprint to create object – A structure to hold variables and methods together
  • 10.
    Related Articles andPost • For more details on Class and Object in Java, See : • What is Class in Java programming language • What is Object in Java programming language • Website: http://javarevisited.blogspot.com /
  • 11.
    LIKED IT? Tweet thispresentation Share this on Facebook