Which is better:C++ or Java???

Hey,People (like my friends)keep tellin me that C++ is better, quicker, etc. than Java! I thnk Java is a lot better. What do you think is better and why so I could have a come-back when me and my friends are arguing about it?

Neither language is wholly "better" than the other. The more appropriate language is determined by the situation. For example, if you don't have much time to code and need your application to be incredibly portable with minimal extra code and testing, Java is almost certainly your best go. If, on the other hand, you want to write a specialized boot loader for your computer, C or C++ are better choices (primarily because Java can't do that).
Of course, if you know how to do things a certain way, the way you know how to do them is always better, even if it's less efficient...
"We must prick them with quills! It's the only way!"
-- A porcupine in the comic strip "Dilbert"

Similar Messages

  • Which is better ? Toplink Java objects or Toplink Entities ?

    Hi
    We are planing to use Toplink JPA that comes with JDeveloper 11g preview release
    I have a question here!
    I would like to get clarified which is better to use :
    1. Toplink Java Objects from Tables ,
    2.Toplink Entities from Tables
    Could you suggest the best approach, and pros and cons of both the approaches?
    Thanking you ,
    Samba

    Samba,
    Ultimately both are using the same TopLink runtime. In the case of Entities you are using JPA and Java Objects you are using TopLink native API and metadata.
    Going forward I would recommend JPA with TopLink extensions as required.
    Doug

  • Which is better for gaming Java or C++?

    a friend of mine told me that C++ is better for gaming, but i'm not sure. the thing about C++ is that i've been studing it for the past 3 years and still don't have a strong grasp of it, but java is much more direct and i'd much rather develop my games in java.

    I have finished to programme a game (Space Commanders) using pure java
    http://www.geocities.com/ddmusc/SpaceCommanders. Now I am re-programming the game using Visual C++ . Once I finish I shall put the windows version on the same site. It will be an interseting example of differences in performance between java and C++.
    For programming I think java is easier since it takes automatic control of memory. Problems such as wild pointers , memory leaks and this kind of stuff are not an issue in Java. Unfortunately this is in itself also a disadvatage since you don't have much control on the amount of memory java is allocating (and at what time it deallocates it).
    Java is also a bit slower because of its automaticity and high level structure. What makes me a bit angry about java is that programmes are normally CPU intensive. It is difficulty to run java programmes on old computers such as 486 or Pentium 1. This reduces the portability of the programme which though it can run on many different OSs it can't run on many different computers.
    Daniel

  • Which is better? JDO or Java Persistance API?

    Hi folks
    I'm trying to build an app on Google's cloud service.
    Looking into this ( [http://code.google.com/appengine/docs/java/overview.html|http://code.google.com/appengine/docs/java/overview.html]), it tells me that for java projects there are 2 possibilities for persistance - JDO , and Java Persistance. Does anyone have any advice on which is better and/or easier? Also, if anyone has a small example they could post, that would be very useful too.
    this isn't exactly a JDBC question, and maybe this should be posted somewhere else? If so please tell me where I should be asking this question.
    Thanks!
    -Tom

    I personally find Java Persistence to be easy to use and it works just fine.
    I can't say if you would agree. You'll just have to judge that for yourself, which means: put some effort into trying it out. I'd start by not requesting small examples in a forum, but by actually looking for them yourself using your search engine of choice.

  • Which is better to use: BEx query or Web Application as an iView in portal?

    Hi gurus!
    Are there any experienced opinions, which is better - publish a BEx query in portal or publish a BEx Web Application in portal? Is it easier to alter the layout attributes etc. if I create a BEx Web Application first before publishing?
    What is the way of fixing for example filter item height if I publish BEx query in portal - is there a Web Application that it uses anyhow which I can fix? Or can I use in that case iView -properties in portal?
    Thankful for advice
    Sari

    ok, means i can use jsp:useBean tag for all my
    classes that are not actually bean. so it will be
    instantiated at run time and provide efficiency .No. Jsp:useBean is used for java bean components.
    >
    but when should i use import statement in my jsp and
    it happen at translation time so will it create any
    type of burden for my code if i import multiple
    classes.For non-java beans, you need to import the classes, period.
    It's not a burden, it's a necessity.

  • Which is better for servers, Apache or Tomcat?

    Which is better for servers, Apache or Tomcat?

    For some reason that link I gave you isn't working right now, but it was today, weird. I would get Tomcat simple because sun uses it in its examples and recommends it. Here's sun's link then, it's probably more useful anyway. http://java.sun.com/products/jsp/

  • Which is better sockets/socketchannel why

    which is better java.io.Socket / java.nio.channel.SocketChannel

    Better for what? They both work. Sockets are simple but only support blocking operations. SocketChannels are about ten times as complex to use but they support non-blocking and multiplexed I/O and also various types of direct and mapped buffering so they can also imply less data movement.

  • Which is better for newbies?

    Which is better for newbies, Jgrasp or Netbeans? I need something that explains errors more thoroughly than Jgrasp.

    Here's my code with 3 errors. Now bear in mind that my program has compiled completely and ran correctly up to this method. All I'm trying to do with this method is get the average of all grades in a multi-array. I researched and found some code that was similar to what I needed to do but it's not working out yet. All other methods in my program work perfectly but I can't get this one to compile.
    public double getMean(int allGrades[][])
              int total = 0;
              for (int grade : allGrades)
              total += grade;
         System.out.println("Total is "+getMean(grades));     
              return total/allGrades.length;
    } // end class GradeBookGradebook.java:100: illegal start of type
              return total/allGrades.length;
              ^
    Gradebook.java:100: <identifier> expected
              return total/allGrades.length;
              ^
    Gradebook.java:100: <identifier> expected
              return total/allGrades.length;
              ^
    3 errors

  • Coding Preference ..Which is better for memory?

    Hey all,
    Javas garbage collection is sweet. However, I was reading somewhere that setting some objects to null after I'm done with them will actually help.
    (help what .. I'm not sure.. my guess is memory used by the JVM)
    Thus I have two ways to do the same thing and I'd like to hear peoples comments on which is "better" ... or will yield faster performance.
    Task: I have a Vector of Strings (called paths) that hold absolute file paths. (Don't ask why I didn't use a String[]) I'd like to check and see if they exist, and if not, create them... I'll use the createNewFile() method for that.
    Method A -- Here I'll reuse that File object
    public void myMethod()throws Exception{
    File file = null;
    for(int i = 0; i < paths.size(); i++){
      file = new File(paths.get(i).toString());
      boolean made  = file.createNewFile();
      if(made){doSomething();}
    file = null;
    }Method B -- Here I'll use um... "dynamically made" ones that I won't eventually be set back to null
    public void myMethod()throws Exception{
    for(int i = 0; i < paths.size(); i++){
      boolean made  = (new File(paths.get(i).toString())).createNewFile();
      if(made){doSomething();}
    }So when the code eventually exists myMethod, the object "file" will be out of scope and trashed.... correct? If thats the case, then would there be any other differences between the two implementations?
    Thanks

    There's no real difference between the two. Choose the style you prefer,
    although in the first one I'd lose the "file = null" statement since that
    variable is about to disappear, and I'm move the definition into the loop
    -- always give variables as small a scope as possible, mainly to
    keep the logic simple:
    public void myMethod()throws Exception{
        for(int i = 0; i < paths.size(); i++){
            File file= new File(paths.get(i).toString());
            boolean made  = file.createNewFile();
             if(made){doSomething();}
    }

  • Which is better, Double Buffering 1, or Double Buffering 2??

    Hi,
    I came across a book that uses a completely different approach to double buffering. I use this method:
    private Graphics dbg;
    private Image dbImage;
    public void update() {
      if (dbImage == null) {
        dbImage = createImage(this.getSize().width, this.getSize().height);
        dbg = dbImage.getGraphics();
      dbg.setColor(this.getBackground());
      dbg.fillRect(0, 0, this.getSize().width, this.getSize().height);
      dbg.setColor(this.getForeground());
      paint(dbg);
      g.drawImage(dbImage, 0, 0, this);
    }that was my method for double buffering, and this is the books method:
    import java.awt.*;
    public class DB extends Canvas {
         private Image[] backing = new Image[2];
         private int imageToDraw = 0;
         private int imageNotDraw = 1;
         public void update(Graphics g) {
              paint(g);
         public synchronized void paint(Graphics g) {
              g.drawImage(backing[imageToDraw], 0, 0, this);
         public void addNotify() {
              super.addNotify();
              backing[0] = createImage(400, 400);
              backing[1] = createImage(400, 400);
              setSize(400, 400);
              new Thread(
                   new Runnable() {
                        private int direction = 1;
                        private int position = 0;
                        public void run() {
                             while (true) {
                                  try {
                                       Thread.sleep(10);
                                  }catch (InterruptedException ex) {
                                  Graphics g = backing[imageNotDraw].getGraphics();
                                  g.clearRect(0, 0, 400, 400);
                                                    g.setColor(Color.black);
                                  g.drawOval(position, 200 - position, 400 - (2 * position), 72 * position);
                                  synchronized (DB.this) {
                                       int temp = imageNotDraw;
                                       imageNotDraw = imageToDraw;
                                       imageToDraw = temp;
                                  position += direction;
                                  if (position > 199) {
                                       direction = -1;
                                  }else if (position < 1) {
                                       direction = 1;
                                  repaint();
              ).start();
         public static void main(String args[]) {
              Frame f = new Frame("Double Buffering");
              f.add(new DB(), BorderLayout.CENTER);
              f.pack();
              f.show();
    }which is better? I noticed smoother animation with the later method.
    Is there no difference? Or is it just a figment of my imagination??

    To be fair if you download an applet all the class files are stored in your .jpi_cache, and depending on how that game requests its graphics sometimes they are stored there to, so really if you have to download an applet game twice, blame the programmer (I've probably got that dead wrong :B ).
    But, what's wrong with Jars. They offer so much more.
    No offence meant by this Malohkan but if you can't organize your downloaded files the internet must really be a landmine for you :)
    Personally I'd be happy if I never seen another applet again, it seems java is tied to this legacy, and to the average computer user it seems that is all java is capable of.
    Admitidly there are some very funky applets out here using lots of way over my head funky pixel tricks, but they would look so much better running full screen and offline.

  • Which is better? Code comparsion of performance and style

    Recently I run into a discussion over a small piece of code. Could help me which is better, either in performance or coding style? The code is not complete, the question is the use of local cancellationNumber variable.
    public String cancelAction(/**/) {
    /* some code */
            String cancellationNumber = result.getCancellationNumber();
            if (empty(cancellationNumber)) {
                throw new Exception("Did not receive a cancellation number!");
            return cancellationNumber;
        }or
    public String cancelAction(/**/) {
    /* some code */
            if (empty(result.getCancellationNumber()) {
                throw new Exception("Did not receive a cancellation number!");
            return result.getCancellationNumber();
        }

    Yes, I know profiling can be misleading, also compiler optimization adds to the picture. However seeing the numbers differentially, I think there is still some information, which is faster, even if taking it completely out scope. I didn't paste the code, because it's so trivial. I run the two methods in a loop with same arguments.
    With increased loop count, the difference is 6-7%, cancelActionWithLocal being faster. But this can be pointless, I know.
    package org.helloprofile;
    import static org.helloprofile.Util.empty;
    import java.util.Locale;
    public class CUT {
        public String cancelActionWithoutLocal(Locale locale, String email, long itineraryId, String confirmationId) throws Exception {
            Result result = new Result();
            if (empty(result.getCancellationNumber())) {
                throw new Exception("Did not receive a cancellation number!");
            return result.getCancellationNumber();
        public String cancelActionWithLocal(Locale locale, String email, long actionId, String confirmationId) throws Exception {
            Result result = new Result();
            String cancellationNumber = result.getCancellationNumber();
            if (empty(cancellationNumber)) {
                throw new Exception("Did not receive a cancellation number!");
            return cancellationNumber;
    }Thanks for the comments!

  • Which is better - Applet or JSP?

    I am creating an appilcation. It basically will use a database to allow users to enter new records or edit existing ones. I'm taking over this project from another person, who started it as an applet but didn't get too far. I'm looking at what is better - applet or plain jsp pages. What are the pluses and minues of each?

    Which is better, apples or oranges?
    The are probably no disadvantages to JSP except that you need a JSP server. The main disadvantage to applets is you almost certainly need the users to have the Java Plugin to run it. If they don't, they have to get and install it. JSP doesn't need any of that.

  • Which is better ODBC or JDBC

    dear all,
    after upgrading most of our servers from cf5 to CFMX7.1, it
    is now time to start working on some performance strategies for the
    upgrades. currently we went with the ODBC connector in CFMX for
    testing purposes. one of our server will occasionally lose the odbc
    and we have to reboot the server to get it rolling again.
    this leads up to the question of which is better for
    performace (speed, less process inducive) and realiability. ODBC or
    JDBC with CFMX7.1
    thanx
    sean

    I would concur ... as CF is java based, it will run better
    with JDBC rather than having to interpret a bridge between the 2.
    There are a couple of very remote instances where ODBC may be
    required, but you will have much better results with JDBC.

  • Which is better,websphere or weblogic?

    Our company want to establish a network serving for PC ,wap ,pda and so on using j2ee.but I don��t know which is better Between Websphere application server and Weblogic.
    Who can tell me in detail?

    Something to start with:
    WebSphere
    1. WebSphere covers more platforms.
    2. WebSphere has a better supportline (IBM know this stuff)
    3. Having DB2 as a database, you might want to use WebSphere, since it has a lots of advantages of using both the database and AppServer from the same Vendor.
    WebLogic:
    1. WebLogic is a more possisioned appserver
    2. I 'believe' weblogic is more up to date with java versions and technologies
    regards
    Andreas

  • Xerces or JDOM which is better?

    hi all
    i would like to ask for some opinions.
    Xerces and JDOM which is better?
    thanks!

    This dude is right. JDOM6 is the bomb.
    here is a little present:
    import java.io.*;
    import java.io.File;
    import java.util.List;
    import java.util.Iterator;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.JDOMException;
    import org.jdom.adapters.*;
    import org.jdom.adapters.CrimsonDOMAdapter;
    import org.jdom.input.DOMBuilder;
    import org.jdom.output.XMLOutputter;
    public class xmltest
    // Global value so it can be ref'd by the tree-adapter
    public static Document document;
    public static DOMBuilder builder;
    public static String product_name, description, price;
    public static Double checkPrice;
    public static void readDoc()throws IOException, JDOMException
    builder = new DOMBuilder();
    try {
    FileInputStream in = new FileInputStream(new File("settings.xml"));
    document = builder.build(in);
    in.close();
    } catch (IOException ioe) {
    ioe.printStackTrace();
    public static void listProducts()throws IOException, JDOMException
    readDoc();
    Element root = document.getRootElement();
    List products = root.getChildren();
    Iterator productsIterator = products.iterator();
    System.out.println("Currently " + products.size() + " products.");
    while(productsIterator.hasNext()){
    Element productElement = (Element)productsIterator.next();
    List product = productElement.getChildren();
    System.out.println(productElement.getTextTrim());
    Iterator productIterator = product.iterator();
    while(productIterator.hasNext()){
    Element attElement = (Element)productIterator.next();
    System.out.println(attElement.getName() + " : " + attElement.getText());
    public static void removeProduct(String productName)throws IOException, JDOMException
    readDoc();
    Element root = document.getRootElement();
    List products = root.getChildren();
    Iterator productsIterator = products.iterator();
    root.removeChildren();
    while(productsIterator.hasNext()){
    Element tempElement = (Element)productsIterator.next();
    if(!tempElement.getTextTrim().equals(productName)){
    root.addContent(tempElement);
    document.setRootElement(root);
    saveChanges();
    public static void addProduct(String product_name, String description, String price)throws IOException, JDOMException
    readDoc();
    Element product = new Element("product");
    Element root = document.getRootElement();
    product.addContent(product_name);
    product.addContent(new Element("description").addContent(description));
    product.addContent(new Element("price").addContent(price).addAttribute("currency", "US"));
    root.addContent(product);
    saveChanges();
    public static void saveChanges(){
    try {
    XMLOutputter outputter = new XMLOutputter();
    FileWriter writer = new FileWriter("settings.xml");
    outputter.output(document, writer);
    writer.close();
    } catch (java.io.IOException e) {
    e.printStackTrace();
    public static void main(String argv[])throws IOException, JDOMException
    int selection;
    for(;;){
    System.out.println("1. Add a product\n2. Remove a product\n3. View products\n4. exit program");
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    try{
    selection = Integer.parseInt(in.readLine());
    switch(selection){
    case 1:
    System.out.println("Enter product name.");
    product_name = in.readLine();
    System.out.println("Enter product description.");
    description = in.readLine();
    System.out.println("Enter product price.");
    price = in.readLine();
    try{
    checkPrice = new Double(price);
    addProduct(product_name, description, price);
    }catch(Exception e){
    System.out.println("The product's price must be a numeric value.");
    break;
    case 2:
    System.out.println("Enter product name to remove.");
    product_name = in.readLine();
    removeProduct(product_name);
    break;
    case 3:
    listProducts();
    break;
    case 4:
    System.exit(1);
    break;
    default:
    System.out.println("The number you have typed is incompatible with the menu.");
    break;
    }catch(Exception e){
    System.out.println("Please type in a number that maches the menu.");
    enjoy....

Maybe you are looking for

  • PO Document type in ME59

    Hi... During conversion of PR to PO through ME59 , how will the system determine which Purchase order document type to be generated for PO, i.e suppose if i have two  PO document type Z1 & Z 2, and if i create a PO from PR through ME59 how will the s

  • How can I fix having to "save" before I can even open a PDF?

    I have Adobe Acrobat 9 Pro (9.5.5) and when a recent update came thru I am no longer able to simply click and view the PDF sent, but now am required to save it before viewing.  Is there any simple way to correct this back to the old way?  I don't wan

  • ARE1 link to Excise invoice

    Hi gurus, Can any one tell me how to get the ARE1 form number on the printout of output type ARE1 which can be excuted from VF03 as well J1IP. when i post the ARE1 document in j1ia101 i am getting the Form no. in SAP and its getting updated in the ta

  • Facing pages options missing in new Pages

    Am I missing something or is the facing pages options not available in new Pages app?

  • Too many photos on iphoto

    Should I create several libraries to manage a large amount of photos , or can i load all 10,000 photos without causing slowdowns .