variable's types

hi all,

I caught up with one prob relating to variables and its datatype..

for example,

int testInteger = 0;

int is the datatype
testInteger is the variable name
0 is the value

however, for

MyClass className = MyClass();

how is MyClass the datatype?
eturfclubAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

objectsCommented:
that should be:

MyClass className = new MyClass();
0
objectsCommented:
MyClass is class that the variable className references an instance of
0
eturfclubAuthor Commented:
oh... so MyClass() is juz a dummy in this case juz to tell java that there's no constructor argument to be parsed into the class?
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

objectsCommented:
Yes MyClass() says to call the classes default (no arguments) ctor.
0
eturfclubAuthor Commented:
how about interfaces??

interfaceOne variableName = new className();

how does this explain in this context? kindly advice.
0
objectsCommented:
variableName references an instance that implements interfaceOne.
In this case it references an instance of className
0
eturfclubAuthor Commented:
hmm.. meaning... mind to show me a little snipplet code ? thankx..
0
objectsCommented:
List l = new ArrayList();

the variable l has type List
But it references an instance of ArrayList (which implements List)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eturfclubAuthor Commented:
thanks..
0
objectsCommented:
no worries :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.