This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Interview question" Watch "Interview question" New topic
Author

Interview question

surya praveen
Greenhorn

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

Joined: Jun 24, 2003
Posts: 3274
    
    5

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
Bartender

Joined: Jun 06, 2007
Posts: 2713
    
    5

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.


SCJP, SCWCD.
|Asking Good Questions|
Paul Sturrock
Bartender

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
Marshal

Joined: Mar 22, 2005
Posts: 39577
    
  27
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 ]

Ping & DNS - updated with new look and Ping home screen widget
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1976
    
    7

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/OCM-JD OCPJP7
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interview question
 
Similar Threads
mock exam question
overload question
UML 486 Question
JspFragment
how can i print an xml document through dom api