![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2008
Posts: 0
Rep Power: 0
![]() |
how to tell C++ from Java source code?
All right, I admit I'm not a programmer (I took a couple of courses and have done a smattering in Fortran and Databus, but...I'm not a programmer). However, I need to know - if someone showed me their source code, how would I recognize whether I'm looking at C++ or Java? Without asking them, of course. Why? Because I've been tasked with figuring this out as part of a technical interview for a job. I appreciate your help. - Bill
|
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
Re: how to tell C++ from Java source code?
if this is an interview for a job sureley it is no good asking someone to tell you. If you can't do it and it is needed for the job then if you get the job then what will you do?
Edit: Why don't you look at some examples of C++ programs and Java Programs and see where they differ, that would be the best idea. Chris
__________________
Who said i couldn't program sarcasm = raw_input('Type in a sarcastic remark: ')
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: May 2008
Location: teh interwebz
Posts: 22
Rep Power: 0
![]() |
Re: how to tell C++ from Java source code?
I recommend just looking up tutorials of the two different languages and becoming familiar with the differences in syntax
of course the most obvious thing would be if you have the source files then you can tell by the file extensions...
__________________
iEngage |
|
|
|
|
|
#4 | |
|
Newbie
Join Date: May 2008
Posts: 0
Rep Power: 0
![]() |
Re: how to tell C++ from Java source code?
Quote:
// <program-name>.java Do all Java programs begin this way? Do C++ programs begin differently? |
|
|
|
|
|
|
#5 |
|
Newbie
Join Date: May 2008
Posts: 0
Rep Power: 0
![]() |
Re: how to tell C++ from Java source code?
Thanks. The file extension for a Java program would be .java, right? What about for a C++ program?
|
|
|
|
|
|
#6 |
|
Expert Programmer
|
Re: how to tell C++ from Java source code?
I sincerely hope you are joking. If one of the questions you are asked in an interview is what language a file ending in .java is written in, one can only imagine the high expectations your would-be employer must have of you.
|
|
|
|
|
|
#7 |
|
Newbie
Join Date: May 2008
Location: teh interwebz
Posts: 22
Rep Power: 0
![]() |
Re: how to tell C++ from Java source code?
file extension for C++ files is usually .cpp
although like titanium decoy says, if all you have to know is what different file extensions mean then how good could that job really be? as for your other question, yes there is something in the code that will tell you which it is, but you have to do what Freaky Chris said. You need to actually take the time to look at different code examples and learn to recognize the syntax.
__________________
iEngage |
|
|
|
|
|
#8 |
|
Newbie
Join Date: May 2008
Posts: 11
Rep Power: 0
![]() |
Re: how to tell C++ from Java source code?
Before I go any further, I must say that if this is a skill you must possess to perform your work task, it's not wise to simply ask a forum how to tell the difference. That would be the equivalent of a cheat sheet. Does good on the test, but then it has no practicality in the real world.
That being said, I'd suggest reading lots of code and picking out the differences for yourself. As for your question, // doesn't indicate rather the code is C++ or Java. // is simply a comment, and it's a comment in C++ and Java. Perhaps someone could correct me if I'm wrong, but I don't think a /**/ comment is a Java comment. I believe that's exclusively a C++ comment, but I may be wrong. |
|
|
|
|
|
#9 |
|
Newbie
Join Date: May 2008
Location: teh interwebz
Posts: 22
Rep Power: 0
![]() |
Re: how to tell C++ from Java source code?
/* */ is for multi-line comments. it's found in quite a few languages actually, including Java
__________________
iEngage |
|
|
|
|
|
#10 |
|
PFO Founder
![]() ![]() |
Re: how to tell C++ from Java source code?
cpp Syntax (Toggle Plain Text)
java Syntax (Toggle Plain Text)
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Presenting source code within html | Wizard1988 | Other Web Development Languages | 21 | Mar 20th, 2007 8:37 PM |
| java code question | lakitu | Java | 5 | Mar 6th, 2006 6:53 PM |
| Different IDE's Different code | 357mag | Java | 1 | Mar 26th, 2005 3:42 PM |
| Game ideas and source code | code10 | Coder's Corner Lounge | 1 | Mar 19th, 2005 11:24 AM |