diff c++ and java..?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2009
Posts: 11
Reputation: lyardson is an unknown quantity at this point 
Solved Threads: 0
lyardson lyardson is offline Offline
Newbie Poster
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: diff c++ and java..?

 
1
  #2
May 29th, 2009
Nobody is gonna do that for you. Seriously?

However, here are a few things I have noted.

hello world in java
  1. interface Printer
  2. {
  3. void print ( Message message );
  4. }
  5.  
  6. class Message
  7. {
  8. private String message;
  9.  
  10. public Message ( String message )
  11. {
  12. this.message = message;
  13. }
  14.  
  15. public void print ( Printer printer )
  16. {
  17. printer.print ( this );
  18. }
  19.  
  20. public String toString()
  21. {
  22. return message;
  23. }
  24. }
  25.  
  26. abstract class AbstractPrinterFactory
  27. {
  28. public static AbstractPrinterFactory getFactory()
  29. {
  30. return new SystemOutPrinterFactory();
  31. }
  32.  
  33. public abstract Printer getPrinter();
  34. }
  35.  
  36. class SystemOutPrinterFactory extends AbstractPrinterFactory
  37. {
  38. public Printer getPrinter()
  39. {
  40. return new SystemOutPrinter();
  41. }
  42. }
  43.  
  44. class SystemOutPrinter implements Printer
  45. {
  46. public void print ( Message message )
  47. {
  48. System.out.println ( message );
  49. }
  50. }
  51.  
  52. class HelloWorld
  53. {
  54. public static void main ( String[] args )
  55. {
  56. Message message = new Message ( "Hello, World!" );
  57. AbstractPrinterFactory factory = AbstractPrinterFactory.getFactory();
  58. Printer printer = factory.getPrinter();
  59. message.print ( printer );
  60. }
  61. }
[1]

hello world in c++ (note the difference in file size)
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. cout << "Hello, World!" << endl;
  7. return 0; // it's very important, because you win, when ALL is Nothing ; }
  8. }

Java is perfect, extremely fast, has no bugs! The fact that it *just works* on ANY operating system makes it superior to c++.

C++ also tends to be slower than java (scientifically proven) as monkeys tend to write code in c++ as opposed to humans writing code in java.

[1] An optimized version of java's hello world by James Gosling
  1. public class HelloWorld
  2. {
  3. public class Program
  4. {
  5. public class start implements Program
  6. {
  7. public class init excludes mouse
  8. {
  9. public class HelloWorld implements init
  10. {
  11. public int main()
  12. {
  13. System.Java.Out.Output.Console.Write.Line.Text.White.BlackBackground.Last.Lineofcode.this.time.will.really.finish("Hello, world!");
  14. }
  15. }
  16. }
  17. }
  18. }
  19. }
Last edited by iamthwee; May 29th, 2009 at 7:09 am.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,849
Reputation: niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute 
Solved Threads: 299
Moderator
Featured Poster
niek_e's Avatar
niek_e niek_e is online now Online
Roasting Maven

Re: diff c++ and java..?

 
0
  #3
May 29th, 2009
Originally Posted by lyardson View Post
the exact diff between c++ and java technically
Technically 'Java' has one more character then 'C++'
Last edited by niek_e; May 29th, 2009 at 7:05 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: diff c++ and java..?

 
0
  #4
May 29th, 2009
Try Google: C++ Java comparison
Are you sure that it's a question for a half-page forum answer?
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 38
Reputation: DarthPJB is on a distinguished road 
Solved Threads: 4
DarthPJB's Avatar
DarthPJB DarthPJB is offline Offline
Light Poster

Re: diff c++ and java..?

 
1
  #5
May 29th, 2009
>Java is perfect, extremely fast, has no bugs! The fact that it *just >works* on ANY operating system makes it superior to c++.
Name any commonly (or uncommonly) used OS c++ can't be compiled for?

>>C++ also tends to be slower than java (scientifically proven) as >>monkeys tend to write code in c++ as opposed to humans >>writing code in java.
what monkeys are these? I've get to see a 3D rendering engine in Java that can even come close to a similar product in C++.
If your refering to something like
http://www.freewebs.com/godaves/javabench_revisited/
then there's many a rebuttle by something like http://kano.net/javabench/
I don't mean to come across as overbearing and if you prove me wrong then I shall accept it joyously. However your statements seem to fly in the face of my (somewhat limited) knowlege on the subject.
code tags, there to give us line numbers and colours! [code] is bad, [code=C++] is good!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: diff c++ and java..?

 
0
  #6
May 29th, 2009
> Name any commonly (or uncommonly) used OS c++ can't be compiled for?

Windows xp, windows 2000, windows vista to name but a few as the number of virii generally prevents the OS from even starting up.

>what monkeys are these?
The ones that can swing from trees and eat bananas.

>and if you prove me wrong then I shall accept it joyously
I expect to see you wearing a big joyous grin on your face then.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: diff c++ and java..?

 
1
  #7
May 29th, 2009
iamthwee.thank(you).for(post(number(2)));
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 38
Reputation: DarthPJB is on a distinguished road 
Solved Threads: 4
DarthPJB's Avatar
DarthPJB DarthPJB is offline Offline
Light Poster

Re: diff c++ and java..?

 
0
  #8
May 29th, 2009
Originally Posted by iamthwee View Post
> Name any commonly (or uncommonly) used OS c++ can't be compiled for?

Windows xp, windows 2000, windows vista to name but a few as the number of virii generally prevents the OS from even starting up.

>what monkeys are these?
The ones that can swing from trees and eat bananas.

>and if you prove me wrong then I shall accept it joyously
I expect to see you wearing a big joyous grin on your face then.
By that same logic Java cannot be run on those platforms because they wont have started, thus your logic is incorrect. Also just because 90% of the user base entrust their security to norton and then wonder why their system is slow and they have viruses cannot be blamed on the OS. Though it's vulnerability can and I accept that. although it hardly proves your point either way as the code can still be compiled for the windows OS' even if the end user cannot run it, or it's Java equivalent.

As for the monkey statement, find me a video of a big furry monkey programming in c++ and successfully compiling and I'll get you a cookie the size of the big joyous grin I'll have for you.

I have to say your monkey statement did put a big grin on my face though :p.
Last edited by DarthPJB; May 29th, 2009 at 10:23 am. Reason: can't spell 'big'
code tags, there to give us line numbers and colours! [code] is bad, [code=C++] is good!
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,652
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 723
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: diff c++ and java..?

 
3
  #9
May 29th, 2009
DarthPJB, it's a good idea to not take iamthwee seriously, in pretty much every case from what I've seen.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 110
Reputation: s_sridhar has a little shameless behaviour in the past 
Solved Threads: 11
s_sridhar's Avatar
s_sridhar s_sridhar is offline Offline
Junior Poster

Re: diff c++ and java..?

 
0
  #10
May 29th, 2009
Java doesn't support pointers, while c++ supports pointers
Last edited by s_sridhar; May 29th, 2009 at 10:35 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC