Nov 21, 2009
Pages: 1, 2

What Are The Advantages Of Java Vs C++?

free web hosting

Read Latest Entries..: (Post #15) by iGuest on Jul 10 2008, 03:47 PM.
Afrothunder has some excellent points. However, as systems get faster Java's speed in no longer critical issue. If you are new to programming, Java is the perfect language to learn computer concepts. I teach Adnanced Placement Computer Science in high school. I have taught BASIC, Pascal, C++ and now Java to high students. Try teaching students to write game programs for their cell phones with C++ and you will appreciate Java's portability. Everything you need to start programming in Java i...
read more.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > Java

What Are The Advantages Of Java Vs C++?

silverkirfsco
what are the advantages of c++ and what are the advantages of java?

what one is more userfriendly, and what one has more capabilities?

Comment/Reply (w/o sign-up)

BabyTux
QUOTE
Java is designed to be simple, object oriented and similar to C++ while removing the unnecessary complexities of C++. It is also said to be a robust, architecturally neutral, portable, interpreted, threaded, dynamic and high performance language. Java enables the development of robust applications on multiple platforms in heterogeneous, distributed networks. C++ is not truly portable nor is it suited to heterogeneous, distributed networks. While C++ excels in high performance, its powerful features and complexities are often the source of many errors.

Comment/Reply (w/o sign-up)

insanedodgers
C++ is new generation computer language.

I like both : )

Comment/Reply (w/o sign-up)

Jguy101
Oh, and you can run Java programs and applets on any computer, no matter what the OS, as long as it's equipped with the Java Virtual Machine, which is free. biggrin.gif

Comment/Reply (w/o sign-up)

pixelsmack
C++ can be a very fast language when compiled hence its use in device drivers and other core applications (alongside C). Java is moer userfriendly for writing applications for that will contain a GUI as it is mostly self contained and will run completley indipendantly of system or operating system. C++ does not have this advantage and external compile files or systems may be required to run software you design, this is especially true on linux and unix.

Comment/Reply (w/o sign-up)

silverkirfsco
what one is easier to create graphics with?

and what one requires more computing power?

Comment/Reply (w/o sign-up)

Soleq
It depends on what you mean by graphics. For a simple GUI, Java's Swing API is easy to use, and usually built in or included as an add-on package to install. There's another GUI API, but it slipped my mind. I always just used Swing.

Java, as stated before, can be complied to run on the JVM. This creates a multi-platform application that you can easily distribute. The only negative part about this is performance, where the JVM is often sluggish and not fully robust enough for me to trust. I'm using a Yearbook creation software for a school, and it's the most poorly designed (and hideous) program I've seen in years, and I suspect that the problems lie mostly in the Java architecture rather than program design (could be wrong, but honestly, would anyone purposefully write a program that requires you to quit the application to open a new file?) I hated the JVM, and probably always will.

C++ has its downfalls as well. It's harder to learn (generally), but more importantly, it's a ***** to actually port to other processors. Since most APIs are processor specific, you'd have to find a comparable API to fill in the gaps that can't be used again. The OOP concept is essentially the same, so that's a moot point here.

If I had to classify Java and C++, I'd say Java is for learning, and C++ is for coding. C++ has significant advantages when it comes to performance, and can smoke Java in equal settings.

 

 

 


Comment/Reply (w/o sign-up)

qwijibow
QUOTE
C++ has its downfalls as well. It's harder to learn (generally), but more importantly, it's a ***** to actually port to other processors. Since most APIs are processor specific, you'd have to find a comparable API to fill in the gaps that can't be used again. The OOP concept is essentially the same, so that's a moot point here.


You mean each Operating system has its own API's.
C++ if coded with portability in mind, is very very very easy to port.
Just re-compile.

aslong as you stick to C++ standards ( for example using fstream for file access instead of microsofts FILE class, < which does exactly the same thiing as fstream, except its not portable>)

Infact, The only parts that are difficult to port between windows, and the rest of the OS's is the GUI. and this can be nullified by using the GTK, QT or SDK libraries in c++ for GUI control.

In other words... IF a c++ project is designed with portability in mind, porting is as simple as a re-compile.

ANYWAYS... advantages of Java which nobody has pointed out jet...

1) Garbage collection. in java you dont have to delete memory when you have finished with it, it is virtualy impossable to wrte a program in java which suffers from memory leaks.

2) No Raw memory access. Although c++ raw memory access is lightning fast, Java takes away memory manage,ment from the porogrammer, making it virtually impossable to make a mistake which could result in a buffer overflow vunerability.

Some aspects or very confusing though.
for example in c++ you can simply declair an array of user defined object, and begin using them..

example
CODE
myObject  objectArray[ 100 ];


BUT in java, to do the same thing you need to
CODE
myObject[ ] objectArray = new myObject[100];
for(int n=0; n<100; n++) {
   objectArray[ n ] = new myObject;
}


this is because, in the java virtual machine, line one one creates an array of 100 pointers to myObject, you then need the loop to create 100 objects and assign them to pointers

This part of the java language only makes sence if you understand memory management and pointers (which you will only get from learning c or c++)

Comment/Reply (w/o sign-up)

Jguy101
QUOTE (Soleq @ Mar 10 2005, 04:35 PM)
It depends on what you mean by graphics.  For a simple GUI, Java's Swing API is easy to use, and usually built in or included as an add-on package to install.  There's another GUI API, but it slipped my mind.  I always just used Swing.

Java, as stated before, can be complied to run on the JVM.  This creates a multi-platform application that you can easily distribute.  The only negative part about this is performance, where the JVM is often sluggish and not fully robust enough for me to trust.  I'm using a Yearbook creation software for a school, and it's the most poorly designed (and hideous) program I've seen in years, and I suspect that the problems lie mostly in the Java architecture rather than program design (could be wrong, but honestly, would anyone purposefully write a program that requires you to quit the application to open a new file?)  I hated the JVM, and probably always will.

C++ has its downfalls as well.  It's harder to learn (generally), but more importantly, it's a ***** to actually port to other processors.  Since most APIs are processor specific, you'd have to find a comparable API to fill in the gaps that can't be used again.  The OOP concept is essentially the same, so that's a moot point here.

If I had to classify Java and C++, I'd say Java is for learning, and C++ is for coding.  C++ has significant advantages when it comes to performance, and can smoke Java in equal settings.
*
I don't think that's the JVM's fault, it sounds more like a creation of a dumb programmer. After all, Oracle SQL was written in Java....

Comment/Reply (w/o sign-up)

thedevil
Let me share my knowledge about Java and C++.
C++ was here before Java came and its obvious for C/C++ to grab large portion of the market. but it does not make C/C++ the only programming language. Everyone Prefers C and C++ because it works as a middle tier of highlevel language and lowlever language. you get both power of programming at root as well as at the top. due to this popularity there are more C/C++ compiler than other languages. like GNU C++ or G++, Turbo C++, Borland C++, Devshed C++, MS C++ and many more they come in many flavour. some are specifically for windows. like VC++. I have not heard any one coding application in VC++ for Linux.
Due to this popularity C and C++ has become powerful more and more day by day and today it stands as a ruler in languages. And Microsoft had added a new flavour to C and C++ called C#. Though C# is made from the scratch. It is based on the same norm of C and C++.
C++ is handy as it supports both the structured programming and OOP. It is easy if you do not get overdriven by Pointers and end up crashing your software with an error reading "Illegal Referenc to this and that" or "Null Pointer Assignment". Memory management in C/C++ is totally on hands of a programmer. Though there are software to check the memory leaks and garbage collection. But memory management is tedious in C/C++. If you are well with Pointers and memory management then C++ should be your choice.
And talking about Graphics and others there are plugin API specially for Graphics, I think much of the graphics software or games are made in C/C++ and their other flavours.

Java is great Programming language. And I like to code in Java than in C/C++ because of its ease of use. I have heard that the codes in java are 4 times smaller than the codes written in C/C++ for the same job. Java manages memory itself by its garbage collector. and it eliminates the pointers and itself is based on references. I mean any variable you create are references. Java is easy to use for the programmers from the C/C++ background coz it has the same look and feel of coding.[The curly braces I love Curly braces{}]

Graphics in Java is good. The new JDK2 comes with more powerful Graphics API and I think you will hardly need 3rd Party API.

Moreover Java is platform independent and secure. You can port your program to any platform without any hassle.
I code Java program in windows and use it in Linux and viceversa. Its fun. you need not bother about portability as long as you have JVM running....

And there are many to follow...
Now you make choice which one is better..

Comment/Reply (w/o sign-up)

Latest Entries

iGuest
Afrothunder has some excellent points. However, as systems get faster Java's speed in no longer critical issue. If you are new to programming, Java is the perfect language to learn computer concepts. I teach Adnanced Placement Computer Science in high school. I have taught BASIC, Pascal, C++ and now Java to high students. Try teaching students to write game programs for their cell phones with C++ and you will appreciate Java's portability. Everything you need to start programming in Java is free, I repeat FREE. Even the J2ME to create programs for cell phones is free. So far based on my personal experience and from feedback I have received at blogs like this, the majority of negative comments on Java seem to come from C++ programmers who have less than one year serious experience with Java. They are too proud to admit what they don't know or to ask for help!

-reply by Jose

Comment/Reply (w/o sign-up)

iGuest
Replying to qwijibow
I don't think that is correct. In Java you declare a user defined object array as (for example Student class objects)

ArrayList<Student> list = new ArrayList<Student>( );

You don't bother with pointers, you don't have to use a for-loop. That's it!

-reply by Jose

Comment/Reply (w/o sign-up)

slapbass
I'm primarily java programmer, but some years ago I used c++ as my primary programming language.

I can list some(not all) features which are big adventages in java:
1. garbage collector (you don't think about empty pointers)
2. numerous libraries (especially open-source libraries)
3. almost full object programming
4. cross-platform programming and running
5. you can write programs and pay nothing for licences(free IDE, free frameworks etc.)
6. very big community

Comment/Reply (w/o sign-up)

crackhoarmojo
The whole reason java and C++ are so similar is because java is based on C++. It was acctually made to be used more in web development anyway, something which C++ was lacking. Java cut down on all the memory management and such in order to make web programming easier (try programming the memory managment when you have to think about IE or some other random browser in the mix too....).

Comment/Reply (w/o sign-up)

afrothunder
i know people have already posted alot on this, but here'e my 2 cents.

java is easy. there are a HUGE number of libraries that sun and other people have provided. No matter what you are trying to accomplish, if you look hard enough, you'll find that someone has already written a function to do it for you. In C++, there are quite a few default libraries, but you deal with alot more in depth coding using system calls and whatnot. THis is even more true if you use C (which I do). Besides this, the syntax for the languages are pretty similar, and each could be written to look like the other. The real difference, as I see it, is the performance. C/C++ has very little abstraction between the program and the operating system, making it very fast. Java, on the other hand, has a virtual machine between it and the OS, which increases portability, but decreases speed immensly. Also, java is an entirely interpreted language, which (very basically) means is compiles each line as it reads it, slowing it down further. In the end, unless you're writing an applet for use on a website, theres no reason to use java if you've got a decent amount of programming skill.

-afrothunder

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : advantages, java, c

  1. Java Mouse Movement.
    (2)
  2. Java Memory Leak?
    (2)
     I have been using the picking tool with setShapeCylinderSegment (this returns infinit results but
    is capped). It works just fine for me (in terms of what it does) and it wasn't until just
    recently I noticed that it has been causing my program to spike the memory. I have looked through
    Google to see the problem and apparently it is caused a memory leak. I have tried to solve it by
    simply setting all the variables to null after they are used but this doesn't help. Is there
    something I can do to or a free software I can use to find the exact variable that is causin....
  3. Java And Sql: Data Mismatch
    (6)
    Alright, I'm having some really funky issue with this. I know it's a mismatch (obviously)
    and I want to know if the Astahost community members can help me solve this issue. It's been
    annoying me a lot of late. CODE try{         libSQL myAddNewData = new libSQL();         String
    strRownum =(String.valueOf(jComboBoxLName.getSelectedItem()));         if (intChoice == 1){
                myAddNewData.AddNewData("INSERT INTO CUSDATA (FIRSTNAME, LASTNAME, PHONE, SIN) VALUES
    ('"+ strUserData +"','" + strUserData + "','"  + strUserData + "&....
  4. Simple Java Question
    One Variable; Multiple Classes (5)
    I’m probably the only person that is able to do so much with Java3D and yet still can't
    even get some of the Java basics down. Anyway is it (and if so how is it) possible to make a
    variable editable and readable in multiple class files? It seems like this should be an easy
    question to answer, but here is a little code to help you understand what I am talking about. CODE
    public class test extends Applet{  public int Col = 0;      if(Col==1){     } } class
    TestB extends Behavior {    if(collision == true){   Col = 0;  }else{   Col = 1;  } } Tha....
  5. Java Java.security.accesscontrolexception
    (6)
     I have looked all over the web for a solution and none of them seem to work. Anyway, I am trying to
    load a 3d object onto a scene with a java applet and I get the following error. CODE
    java.security.AccessControlException: access denied (java.io.FilePermission object.obj read) I
    think that it has to do with my java.policy permissions, but I cant find anything that will fix it.
    Has anyone ever seen this error and/or know a solution to it? I am looking for a solution that will
    work on other people's computers without them downloading anything extra (other then ....
  6. Setting Up Java Correctly
    (11)
    First thing, I know the pictures say update 3, I'll update them to 4 soon... Since there's
    been alot of people saying this bot doesn't work!1!1!!elevenone1!11exclamination! I'll tell
    you how to set up your Java, correctly Before I say anything, if you get this problem Exception in
    thread "main" java.lang.NoClassDefFoundError: mudclient press any key to continue. . . This means
    you have set up your Java incorrectly, follow the tutorial properly Also if you are not an
    Administrator on your computer you can't change the Enviromental Variables. If yo....
  7. Loading 3d Models In Java?
    (2)
    I am currently using a 3D cad software to make models. I want to know if it and how it is possible
    to load 3D models using Java. I would like to make a game in java (I know I should be using OpenGL
    for this, but Java seems more secure). Now I have been looking all over the web (And Amazon books)
    for how to load 3D objects. I think java has loaders that convert objects into java objects but I
    can't figure how to use them. I have tried using Java 3D and a bit of JOGL but I have very
    little knowledge about them other then making basic things like cubes (not models). Is ....
  8. Java Db Help Pls
    (2)
    Now I am a compleate newbie to java. Now just from saying that I will get posts that say "read the
    basics first" ect. I know the basics but the way I learn isn't just by going over basics. What I
    want to do/know is if it is possible to connect to a MySQL Database using java. Is it possible and
    if so how? Tutorials and links to tutorials are welcome along with maby a list of required packages
    and an example code of connecting/selecting data. This is for MySQL not SQL (I don't know if
    there is a major difference in java or not). I am currently using SDK1.4.2_16. I ....
  9. Graphcal User Interfaces In Java
    How do you make them? (4)
    Ok, right now I am currently using eclipse, however I can change to whatever if there is something
    else that would be better for this. But I have made a number of java applications, but they all
    simply use the command line for doing their user input and output. However, I have been interested
    in learning how to program graphical user interfaces in java, and was wondering if somebody could
    point me in the right direction, with some easy to understand and follow tutorials. Also, once I
    have done that, what about making a java program that can be easily executed? (I know t....
  10. Java Sdk Vs. Java Jdk?
    What is the difference? (2)
    Ok, so previously I had installed the java SKD on my computer (the one that comes with netbeans), as
    of right now it is version 1.4.2_13 and I really didn't pay much attention to the version.
    Everything seemed to work ok for what I was doing, although I wasn't using netbeans, instead I
    have been using eclipse. (Since I am doing this for a class at school and that is their IDE of
    choice) Anyway my programs have to compile at the command line (not just work in eclipse). I have
    been able to get them to work in eclipse fine, but I am having trouble when I go to the ....
  11. Bluetooth And Java
    (5)
    Hey all Java programmers on Astahost, I'm wondering is it possible for Java to communicate to
    another computer through a Bluetooth device? The reason I ask this is because I want to create an
    instant messenger that would be using the Bluetooth "network" so that people can use their computers
    to communicate from one to another without the use of the Internet. This is very useful in
    situations where you want to talk to a friend nearby but does not have access to the Internet and
    cannot talk to them in person. Thanks, xboxrulz....
  12. Need To Modify Xml Attribute Using Java
    (7)
    hi, Im new to xml parsing and dont know much about. I need to modify the attribute val of a tag in
    a complex xml file im using xpath query to retrieve the node but xpath is read only and cannot
    modify. Im not able to use DOM as the xml is very complex and im not able to go to the exact node....
  13. Mozilla And Java!
    Step by step help needed from seniors in programming for developing a (2)
    Dear senior Members, I am a 18 year old boy. Just some months ago...I thought of an idea of
    developing an extension for mozilla firefox...one of the most popular web browsers out in the world.
    I wont disclose the complete Idea right here but the useful ness of the idea: The extensionm I
    thought about can be used to significantly reduce the bandwith for high speed connections and time
    for the slow connections given that the target person does use thw web for visiting mostly news
    sites, forums and check mails...so all in al a busy person sittin gon a slower connection o....
  14. How Do I Test A Java Aplication
    (11)
    Well..can someone introduce me?(picture introduce is well)....
  15. How To Create Exe File In Java?
    (17)
    Dear friends I came to know that one can build exe files from java application. How this is
    possible? According to me there is no such method in java to cerate exe files. However Microsoft
    used to provide a free system development kit (SDK), for Java, which includes the jexegen tool. But
    one need install Microsoft Java Virtual Machine to run such application. Some people suggest
    InstallAnyWhere.....
  16. Java Phone Book
    A console base java phone book program (5)
    Hello everybody I wrote this program a few months back when I wan learning JAVA.I haven't
    learned java yet though because its to vast. The program is console based. It uses the util package
    of java in a great way. It keeps record in a flat file. You should create a Data file called
    phone.dat in same folder where phone.java is kept. So here is the code:-(phone.java) CODE
    import java .io .*; import java .util .*; import java.awt.event.*; public class phone {
        public void new_record()     {        String id,name,city,add,number,total,list;         
    boolean b....
  17. Other Sound Format Support
    Sound in Java (3)
    I know how to play a sound file in an applet and an application. I was wondering though if anyone
    knows how to make Java play other sound formats such as mp3, wma, etc.. Well especially an mp3. I
    know Java already supports wav, au, and aif How do you play mp3's?....
  18. Snake In Java
    A game i programmed with a friend (2)
    My friend and I have been working on a project. It is called Snake, and its the old fashion snake
    game that used to be on the first cell phones with games. Of course this 1 has a few more features
    but we wanted to keep it simple. It was 100% programmed in Java, no support from other languages.
    I am in Computer Science 2 AP at my high school, so its only my second year with Java, and its my
    first programming language. I've found it extremely easy to learn. Once you understand how to
    use the libraries, and read the JavaDocs then you can do almost anything without ....
  19. How To Configure/intergrate Jboss 4 With Java?
    (1)
    Can someone help me?....
  20. On Why Java Is 'c'ooler!
    additions / criticisms invited (10)
    im basically a C++ programmer and into Java only now..and i seem to falling in love with it. here
    are my thoughts on why i think Java seems cooler /wink.gif" style="vertical-align:middle"
    emoid=";)" border="0" alt="wink.gif" /> i invite people to add on to the list, im sure there are
    great many things i have missed out..things im yet to be enlightened in Java! 1. no more of those
    wierd pointers! this pointer thing always seemed to me something gone all wrong..something that
    lacked better conception. thank god i dont have to use * and & alternatively to deal with on....
  21. Java App To Web App
    (12)
    I have this Java Application that is already coded which interacts with a database. Is there any
    way that would be easy enough to launch this application via a local intranet? It is not in any
    Applet package, but I do have the JARs. Can this be done without too much effort?....
  22. Looking For A Java IDE
    (26)
    Hello Java people! I'm starting to work more on java this spring (university stuff) and I think
    I need a proper IDE. So far my java programming has been in little scale so editor and command line
    compiling has worked just fine. So I'm looking for a good, free IDE. It does not need to have
    fancy features, just what you'd expect from an IDE. My previous experience on IDEs limits
    pretty much to MS Visual Studio. I've also tried out Borland's builders but I've hated
    them, granted they all were quite old versions. So what IDEs you use and what y....
  23. Video Streaming In Web Browser Through Java Or Jsp
    video streaming in web browser (2)
    Can anyone give idea about video streaming in web browser through java or jsp I need to play video
    presentation in my web browser to show all members of the company.For I want to put my video file in
    web server and anyone can access that video just playing on their browser our web browser is
    firefox. We don’t want to use any active X properties or any default media player in web browser
    . Our Platform is linux fedora core4, web server is tomcat 5 . We read the JMF java media Framework
    API, but I couldn’t understand how to use this in our server for linux. There is ....
  24. Java By Example
    (8)
    Java was the first programming language that I learned on my own...no teachers, no friends, just me
    and the internet. One of the best aspects of Java is the heavy documentation provided by Sun and
    every other Java developer out there. Here is a link to a site that lists loads of examples of Java
    code. http://javaalmanac.com/egs/ ? They have examples of setting up a JDBC/ODBC connection for
    database use, creating ZIP files for archival purposes, and simply showing you how to use vectors.
    This site is great for learning the basics and building applications on top of i....
  25. Download Java Ebooks
    Java Books (17)
    Download java books from below sites http://www.gayanb.com/ The eBook links you've posted
    contain a bunch of illegal eBooks. Be aware that this is in direct violation of our TOS . Links
    removed. ....
  26. Need Help: Find Lowest Character Using Java
    (7)
    Heya guys, Been a looooong time eh, yeah well i was kinda buzy with college stuff and all those
    assignments just keep pouring in. I have java this semester and i have "NO" idea how to go abt it, 1
    reason being that my proff. is going real fast in the explaination part and i doubt she knows
    anything in java /blink.gif' border='0' style='vertical-align:middle' alt='blink.gif' /> Newayz
    , i was asked to do a small program in java , heres how it goes : I need to enter a word prefixed
    by the number of letters in it, and the output should show me the smallest character ....
  27. Array Sorting
    Does anyone hava a decent JAVA method (21)
    does anyone have a decent JAVA method that will sort an array from smallest-to highest?
    /mellow.gif" style="vertical-align:middle" emoid=":mellow:" border="0" alt="mellow.gif" /> The one
    i'm trying to write doesn't seem to work... or if you could look at mine below, and tell me
    what i did wrong, that'd be nice to.(if it reallllyyyyyyyyy sucks, please dont laugh to loud
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> ) This should
    take an array and then calculate how many of a number is in it, add it to the first slots....
  28. Java Unlimited
    Java,jsp,servlet,Swing,GUI Designing (14)
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> Common guys
    and let have a chat over robust java! Cheers Arunkumar.H.G....
  29. Using system date in java... How?
    (7)
    How do u use system date in java? I only know how in jsp. In jsp, u need to do the code below to get
    the sysdate String date = DateFormat.getInstance().format(new Date()); and you will be able to
    get the system date which has the format 6/6/04 7:19 AM ______________________ iv tried to do this
    in java import java.util.Date;public String getSysDate() { String date = "";
    String date = DateFormat.getInstance().format(new Date()); return date; }
    there's an error on the variable DateFormat., it cannot resolve symbol. does ....
  30. java.lang.NullPointException
    (4)
    hi, all, I have a question, can anybody give an answer? Thanks in advance. Why the following code
    throws NullPointerException? String v =null;
    System.out.println("aaaaa"+v==null?"":Integer.toString(v.length())); while the following code not?
    String v =null; System.out.println("aaaaa"+(v==null?"":Integer.toString(v.length())));....

    1. Looking for advantages, java, c

See Also,

*SIMILAR VIDEOS*
Searching Video's for advantages, java, c
advertisement



What Are The Advantages Of Java Vs C++?

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com