954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

diff c++ and java..?

the exact diff between c++ and java technically........need to submit a assignment

lyardson
Newbie Poster
12 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

Nobody is gonna do that for you. Seriously?

However, here are a few things I have noted.

hello world in java

interface Printer
{
   void print ( Message message );
}

class Message
{
   private String message;

   public Message ( String message )
   {
      this.message = message;
   }

   public void print ( Printer printer )
   {
      printer.print ( this );
   }

   public String toString()
   {
      return message;
   }
}

abstract class AbstractPrinterFactory
{
   public static AbstractPrinterFactory getFactory()
   {
      return new SystemOutPrinterFactory();
   }

   public abstract Printer getPrinter();
}

class SystemOutPrinterFactory extends AbstractPrinterFactory
{
   public Printer getPrinter()
   {
      return new SystemOutPrinter();
   }
}

class SystemOutPrinter implements Printer
{
   public void print ( Message message )
   {
      System.out.println ( message );
   }
}

class HelloWorld
{
   public static void main ( String[] args )
   {
      Message message = new Message ( "Hello, World!" );
      AbstractPrinterFactory factory = AbstractPrinterFactory.getFactory();
      Printer printer = factory.getPrinter();
      message.print ( printer );
   }
}

[1]hello world in c++ (note the difference in file size)

#include <iostream>
using namespace std;

int main()
{
   cout << "Hello, World!" << endl;
   return 0; // it's very important, because you win, when ALL is Nothing ; }
}


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

public class HelloWorld
{
  public class Program
  {
    public class start implements Program
    {
      public class init excludes mouse
      {
        public class HelloWorld implements init
        {
          public int main()
          {
             System.Java.Out.Output.Console.Write.Line.Text.White.BlackBackground.Last.Lineofcode.this.time.will.really.finish("Hello, world!");
          }
        }
      }
    }
  }
}
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 
the exact diff between c++ and java technically

Technically 'Java' has one more character then 'C++' :icon_wink:

Nick Evan
Not a Llama
Moderator
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
 

Try Google: C++ Java comparison
Are you sure that it's a question for a half-page forum answer?

ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
 

>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.

DarthPJB
Light Poster
47 posts since May 2009
Reputation Points: 70
Solved Threads: 4
 

> 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.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

iamthwee.thank(you).for(post(number(2)));
;)

ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
 

> 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.

DarthPJB
Light Poster
47 posts since May 2009
Reputation Points: 70
Solved Threads: 4
 

DarthPJB, it's a good idea to not take iamthwee seriously, in pretty much every case from what I've seen.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

Java doesn't support pointers, while c++ supports pointers

s_sridhar
Junior Poster
141 posts since Mar 2009
Reputation Points: 17
Solved Threads: 16
 
the exact diff between c++ and java technically........need to submit a assignment

Read this link http://disordered.org/Java-QA.html

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

>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've left my monkey suit and video camera at home. But the cookies did tempt me.

>DarthPJB, it's a good idea to not take iamthwee seriously, in pretty much every case from what I've seen.

Narue you have hurt my feelings.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 
DarthPJB, it's a good idea to not take iamthwee seriously, in pretty much every case from what I've seen.


Ah, I got the feeling when he used circular logic it was humour but I never was one to let misinformation spread! I shall partake in serious debate with someone else. How about you? Where to begin, ah yes a statement that is bound to cause controversy.
Microsoft R teh bestist evar!>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've left my monkey suit and video camera at home. But the cookies did tempt me.

>DarthPJB, it's a good idea to not take iamthwee seriously, in pretty much every case from what I've seen.

Narue you have hurt my feelings.
Don't worry, I still love you.

DarthPJB
Light Poster
47 posts since May 2009
Reputation Points: 70
Solved Threads: 4
 

1>C++ supports pointer whereas Java doesnt
2>Java doesnt supports operator overloading whereas c++ does.
3>Java doesnt have destructor like c++ but uses finalize() in place of it
4>In java objects can only be passed by reference only but in c++ both by value n reference can be passed.
there are few more difference which are discussed by others so im not mentioning it.

patria987
Newbie Poster
9 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

5>Java classes are breeding like amoebas: super (proto) amoeba's name is Object; C++ classes have family trees.

ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
 

thanks a lot...thanks I got many answers....

lyardson
Newbie Poster
12 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

Java is a high language an compared to c++. In java we use a lot of c++ functions but the extra thing in Java is ther are lots of built in funtions which are not in c++.But c++ is the best for learning how to pragram. Professionals use Java in their prijects to save time and work due to built in functions.

mirfan00
Light Poster
29 posts since May 2009
Reputation Points: -9
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You