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

Why are the methods of the math class static?

598


What is diamond operator in java?

510


Why does java not support operator overloading?

672


When do we use synchronized methods in java?

592


When will we use them?

603






Can final class have constructor?

507


Explain the purpose of garbage collection in Java?

584


Is java programming easy?

551


What is the symbol for space?

571


What language is an assembler written in?

563


What is static in java?

565


What are filterstreams?

621


Can we catch more than one exception in single catch block?

607


Is there any case when finally will not be executed?

529


Explain the reason behind ending a program with a system.exit(0)?

608