"Can you list me some features of the java language"(Interview question )

Hi,This was a question I got yesterday in an interview, exactly as the interviewer said it.I listed off it's cross platform feature... what else would you have added?Question 2. He also looked for #2the differences between java and C++"
[265 byte] By [Duffy28] at [2007-9-30 20:47:00]
# 1

A plethora of libraries on several topics are standardized along with the fast evolving Java including GUI, threads, networking (TCP/IP, URLConnection), XML-handling, JDBC etc. in J2SE and servlets, JavaMail etc. on J2EE.

As a language, C++ is more mighty (and has therefore more caveats, gotchas etc.)

BIJ001 at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 2
> Question 2. He also looked for #2the differences> between java and C++"Java is object-oriented.
CeciNEstPasUnProgrammeur at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 3
Memory management is another big difference between Java and C++, ie the garbage collector in Java that takes all the grief out of that.
Jfrain2004 at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 4
platform independence , security ,listeners and interfaces r the major differences
Woofy at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 5
C++: Bjarne Stroustrup has a chrome domeJava: James Gosling has a chrome dome -- Do'h! Well at least:C: Dennis Ritchie has a chrome done :-)
jToohey at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 6
Exception handling.
levi_h at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 7

> Exception handling.

C++ has exceptions.

C++ is object-oriented. The lack of a root Object class, and the ability to write procedural code, does not mean C++ isn't object-oriented. It supports abstract data types, inheritance, polymorphism, etc. What's not object-oriented about that?

C++ doesn't have garbage collection. Class developers manage their own memory.

C++ doesn't have as extensive a collection of built-in libraries as Java.

C++ does allow multiple inheritance of implementation and operator overloading; Java does not allow either.

%

duffymo at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 8
>> C++ has exceptions.I know - the handling of exceptions differs a lot between the two languages. I mean, you can't catch -1 or ... in Java.
levi_h at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 9

> C++ is object-oriented. The lack of a root Object

> class, and the ability to write procedural code, does

> not mean C++ isn't object-oriented. It supports

> abstract data types, inheritance, polymorphism, etc.

> What's not object-oriented about that?

Like I said a while ago: written sarcasm doesn't work. qed

Btw: >>supports<< is the word here. It supports, but doesn't enforce. It ought to be OO.

CeciNEstPasUnProgrammeur at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 10
> Btw: >>supports<< is the word here. It supports, but doesn't enforce. It ought to be OO.Say "Java gives you freedom from choice. " Going to your interview dressed up like a member of Devo,flower pot on head, would only reinforce your conviction.
jToohey at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 11

> Like I said a while ago: written sarcasm doesn't work. qed

It does if you put <sarcasm> tags in/

> Btw: >>supports<< is the word here. It supports, but doesn't enforce. It ought to be OO.

O-O isn't black and white, it's a continuum.

Smalltalkers might say that Java isn't object-oriented, because they still have primitives. I'd say they're wrong.

Look at this forum sometime and see how many people cram procedural code into a main and still call themselves "Java programmers". Java doesn't enforce it, either. There's no way to mandate O-O thought.

%

duffymo at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 12
> I know - the handling of exceptions differs a lot> between the two languages. I mean, you can't catch -1> or ... in Java.catch (Throwable), while not a good practice, is entirely equivalent to catch (...) in my mind.%
duffymo at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 13
>> catch (Throwable), while not a good practice, is entirely equivalent to catch (...) in my mind.Not in my mind - you can't name ... (and use it), for instance.
levi_h at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 14

> It does if you put <sarcasm> tags in/

Too easy, and that wasn't the point back then anyway. :)

> Look at this forum sometime and see how many people

> cram procedural code into a main and still call

> themselves "Java programmers".

Yepp. I dare to say that I do much better design, yet I don't call myself a programmer, even though I get paid for coding.

> Java doesn't enforce

> it, either. There's no way to mandate O-O thought.

Yes and no. IIRC (it's been a very long time, and I mostly did C, anyway), you can write C++ code without ever creating one class. You can't do that in Java. So It's be a bad OOD, but never a good structural design, as structural design doesn't know classes.

CeciNEstPasUnProgrammeur at 2007-7-7 2:20:10 > top of Java-index,Java Essentials,Java Programming...
# 15
Portability at the compiled level.Incremental and dymanic loading facilitiates stuff like servlet engines in a way few languages would.Robust. Always deals tidily with crashes.Sandboxing. No other language is as suitable for untrusted applications.
malcolmmca at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 16
A name that can also mean "coffee".
CeciNEstPasUnProgrammeura at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 17
He is probably a simpleton looking for Garbage Collection and Relection.You should have told if he wants those answers it will cost him $125 an hour then whip out a form for him to sign.
fuchssaa at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 18
Should be Reflection. arg
fuchssaa at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 19

> He is probably a simpleton looking for Garbage

> Collection and Relection.

> You should have told if he wants those answers it will

> cost him $125 an hour then whip out a form for him to

> sign.

i think you could argue function pointers can count as some type of reflection

haroldsmith3rda at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 20
Not a good argument, IMO. I'm not following.C++ classes aren't given metadata that allows you to figure out what methods they have. You might be able to write something on your own equivalent to java.lang.reflect, but using it would be up to you. The compiler wouldn't
duffymoa at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 21

> This was a question I got yesterday in an interview,

> Question 2. He also looked for #2the differences

> between java and C++"

My answer:

"Your joking right?"

Would you hire a mechanic to work on your car if you had to ask him if he knew what a wrench was, and your second question was how's a wrench different from a hammer.

The answer to these questions aren't important in an interview. It tells the interviewer nothing about your skills or talent. It does raise a huge red flag if you can't answer them.

Maybe, this is a crappy job. They are looking for the cheapest person to do the easiest work, and they only care if you know your ABC's.

I would guess that you're looking for your first job as a Java developer, and are happy to take what you can get. Earn some experiences.. etc.. etc.. etc..

Still, if you get this job. Write in the forum three months later and tell us of what you think about working there. I think I know how that posting will sound.

Mustan9a at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 22
is this a homework question?
haroldsmith3rda at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 23
RunTime Type Identification is supported by C++ runtimes, it is normally switched off though.RTTI is definitely not as powerful as Reflection though.
andybaa at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 24

imagine we hav 2 camel. number 1 camel call java and he is slow but easy to rider. number 2 camel is call c++ and he is veri fast but also hav temper liek woman who is experience time of month when hit husband is normal. who wil we liek to take jorney on? i am choose camel of java because i not liek get camel hoof in lower region when least expecting. rember thsi advices.

majindaa at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 25
On those fairly rare occasion where you need this facility in C++ you just use macros to set up a static table which describes the fields that you're going to want to access this way. It's slightly more effort but it's also more controlled.
malcolmmca at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 26
macros? Oh, my.%
duffymoa at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 27

I find these the most prominent characteristics. Java

1. is propriatory, owned by Sun.

2. is dynamically compiled.

3. has automatic memory management.

4. is portable (highly defined, has standard GUI and multi-threading)

5. lacks address-of operator and operator overloading.

6. makes distinction between subclassing and subtyping.

UlrikaJa at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...
# 28
and7. in itself constitutes a closed operating platform.
UlrikaJa at 2007-7-20 0:09:45 > top of Java-index,Java Essentials,Java Programming...