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

Member Avatar for iamthwee

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!");
          }
        }
      }
    }
  }
}
commented: Haha :) +18

the exact diff between c++ and java technically

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

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

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

commented: Thank you for understanding irony +21
Member Avatar for iamthwee

> 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.thank(you).for(post(number(2)));
;)

commented: For getting the number of open and closing parenthesis correct! +21

> 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, it's a good idea to not take iamthwee seriously, in pretty much every case from what I've seen.

commented: LOL - that's the truth! +33

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

Member Avatar for iamthwee

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

commented: :D +7
commented: LOL *hugs* you rock :P +6

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.

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.

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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.