Java
Programming and Technical
Programming
Basics
Distinguish class and object?
Read Solution (Total 10)
-
- Class is a template of object. It tells compiler this is how the object would be(like a design).
Object is actual implementation. It is an instance of the class. In simple words, class doesnt occupy any memory whereas Object does. - 8 years agoHelpfull: Yes(3) No(1)
- class is blue print of the object where as object is instance of the class. By using object we can create instance for the class and one more is object is physical quantity where class is not.
- 6 years agoHelpfull: Yes(1) No(0)
- Class is a blueprint of class, it occupy at doesn't occupy space when created, define by "class", logical entity.
Object is instance of class, occupy space when created, define by "new " mainly, Physical entity. - 8 years agoHelpfull: Yes(0) No(0)
- object can be defined as anything that have has(property) and does(behaviour) part and physically exit is called object, while class can be defined as type of object.
- 8 years agoHelpfull: Yes(0) No(0)
- class is a logical entity which are used to write business logic while object is a real entity which allocate memory
- 7 years agoHelpfull: Yes(0) No(0)
- package com.java.String_Class;
public class FirsttoCap {
public static void main(String[] args) {
String s="This is rupesh reddy";
String s3="";
for (int i = 0; i < s.length(); i++) {
String s2=""+s.charAt(i);
if(i==0){
s3+=s2.toUpperCase();
System.out.println("@i==0 "+s3);
}
else if (s.charAt(i)==' ') {
i++;
s2+=s.charAt(i);
s3+=s2.toUpperCase();
System.out.println("@i==space "+s3);
}
else{
s3+=s2;
System.out.println("@i==other "+s3);
}
}
System.out.println(s3);
System.out.println(s);
}
} - 7 years agoHelpfull: Yes(0) No(0)
- class is similar type of data member and member functional and object .or class is a representation of similar type of object whereas object is a just a buffer or memory area in heap in which aLL THE INSTAnce data member taking a memory
- 7 years agoHelpfull: Yes(0) No(0)
- Class: It is logical entity which contain logic for the application . class is like a blueprint which decide the object creation .
Object: Object is a physical entity which represent the memory allocation .
Eg: if we have created a blueprint for building then we can create multiple building at different location ,so these creation of biulding is called as the object. - 7 years agoHelpfull: Yes(0) No(0)
- Class is a logical entity which defines states and functions.Object is a physical quantity having its own states and behaviour.
- 6 years agoHelpfull: Yes(0) No(0)
- CLASS:-
1.Class is a keyword which is used to create user defined data types or Non-primitive datatypes.
2.Class is used to represent blueprint of an object and its logical entity.
3.So, when we create a class which represents the blueprint of an object, a blueprint class should not have a main method according to java convention.
4.The blueprint class is also known as business logic class.
OBJECT:-
1.In java object is a block of memory created during runtime.
2.According to Object Oriented Programming object is considered as a mirror image of a blueprint of the class.
3.Class is considered as a logical entity where as objects are considered as real entities.
4.According to java convention a blueprint class will never have a main method. - 3 years agoHelpfull: Yes(0) No(0)
Java Other Question