What is the difference(or similarity if there are some)
between object and a variable?

Answer Posted / dipty

A variable can hold asingle type of variable at a time..but an object can hold a number of variables of different type.

int a = 4; // a would be the variable
Car b = new Car();// b is an object
b.carGo();// this is an method in the object car created below.
class Car()
{
void carGo()
{
car moves;
}
}

Is This Answer Correct ?    14 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define jit compiler?

653


What is blank final variable?

559


What is the difference between stringbuffer and stringbuilder?

572


What are the differences between path and classpath variables?

484


How to connect to a remote database using Applet?

2039






Can there be an abstract method without an abstract class?

531


Which data type is a class in java?

569


How do you sort an array in java?

533


Is null an object in java?

557


What is the purpose of an interface?

548


What's a method in programming?

543


How do you bind variables?

516


What is try-with-resources in java?

603


Can a main method be declared final?

579


What are the main differences between the java platform and other platforms?

524