jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Interview question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Interview question" Watch "Interview question" New topic

Interview question

surya praveen

Joined: Aug 11, 2008
Posts: 3
hi ,
Can anyone explain "how can we explain object and class using real time exmples?"
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

Originally posted by surya praveen:
hi ,
Can anyone explain "how can we explain object and class using real time exmples?"

See http://en.wikipedia.org/wiki/Class_(computer_science)
See http://en.wikipedia.org/wiki/Object_(computer_science)

As for 'real time examples' you could discuss the concept of an 'Event', e.g. An Event class represents trade events flowing through a financial system in real time, an instance of that Event class is the object.

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Amit Ghorpade

Joined: Jun 06, 2007
Posts: 2801

Firstly please UseAMeaningfulSubjectLine for your topic.
This is your second thread with the same subject "Interview question".
Regarding your question, an object can be a student with roll number 123
whereas student itself is a class.
Please take some time to read the ask good question link below.

|Asking Good Questions|
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Hmm. I don't want to sound discouraging, but if you struggle with this question in an interview, you are probably not ready to be interviewing for a Java job.

Rather than go through that pain, have a read through the Java tutorial. This covers the basics. You might also Google for "Thinking In Java" which is a good, free book about the language.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
As for 'real time examples' you could discuss the concept of an 'Event'

I'm fairly certain that what is meant here are "real world examples", not "real time examples".
[ August 11, 2008: Message edited by: Ulf Dittmer ]
K. Tsang

Joined: Sep 13, 2007
Posts: 2994

I agree with Paul. If you ask this. Why not ask can a car for example be an "object"? Can car be a "class"?

Ultimately I personally think, anything can be object and/or class depending on how you look at it. It's like if it "has" attributes then it's a class/object. If it can't have any lower-denominated attribute (so to speak) then it can't be class/object.

Simple definition in real life is object=physical representation and class=logical representation of something.

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
I agree. Here's the link: http://aspose.com/file-tools
subject: Interview question
It's not a secret anymore!