Results 1 to 8 of 8
Like Tree3Likes
  • 2 Post By cselic
  • 1 Post By JosAH

Thread: Why is Java called a programming language?

  1. #1
    Vinx is offline Member
    Join Date
    May 2012
    Location
    USA
    Posts
    38
    Rep Power
    0

    Default Why is Java called a programming language?

    I'm not trying to start any arguments here, and I know Java is a programming language. I just don't really understand the reasoning of why it's called a programming language. This isn't meant to spark up flame, it's merely a question.



    If Java is derived from C++, and if it's merely a higher-level version of C++ then wouldn't it be considered a scripting language since it's only interpreting C++?

    I'm aware there are flaws in my logic, I just need them cleared up. I'm confused.

  2. #2
    cselic is offline Senior Member
    Join Date
    Apr 2010
    Location
    Belgrade, Serbia
    Posts
    278
    Rep Power
    6

    Default Re: Why is Java called a programming language?

    Why told you, or where you read that Java was interpreting C++ = script language?

    I found this quote: "A Java application is a stand-alone program that can be executed using a Java interpreter."

    When we compile a java code is translated in a byte code.

    For example:

    Java Code:
    for (int i = 2; i < 1000; i++) {
          for (int j = 2; j < i; j++) {
              if (i % j == 0)
                  continue outer;
          }
          System.out.println (i);
      }
    After translation with java compiler on byte code it should look something like that:

    0: iconst_2
    1: istore_1
    2: iload_1
    3: sipush 1000
    6: if_icmpge 44
    9: iconst_2
    10: istore_2
    11: iload_2
    12: iload_1
    13: if_icmpge 31
    16: iload_1
    17: iload_2
    18: irem
    19: ifne 25
    22: goto 38
    25: iinc 2, 1
    28: goto 11
    31: getstatic #84; //Field java/lang/System.out:Ljava/io/PrintStream;
    34: iload_1
    35: invokevirtual #85; //Method java/io/PrintStream.println:(I)V
    38: iinc 1, 1
    41: goto 2
    44: return

    source: Java bytecode - Wikipedia, the free encyclopedia
    Last edited by cselic; 07-13-2012 at 01:37 AM.
    Vinx and kammce like this.

  3. #3
    Vinx is offline Member
    Join Date
    May 2012
    Location
    USA
    Posts
    38
    Rep Power
    0

    Default Re: Why is Java called a programming language?

    Quote Originally Posted by cselic View Post
    Why told you, or where you read that Java was interpreting C++ = script language?
    I was watching a Java to C++ tutorial because I was interested in C++, he said "Java is derived from C++" and on some blog I read "Java interprets C++". I guess I should have done more research before asking the question, thank you for clearing this up.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,474
    Rep Power
    21

    Default Re: Why is Java called a programming language?

    Java's syntax is based on C++, but that's about it.
    The JVM could be written in any language...
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,043
    Blog Entries
    7
    Rep Power
    23

    Default Re: Why is Java called a programming language?

    First they wanted to call it 'Java the aardvark' but the Society Against Making Fun Of Aardvarks (SAMFOA) protested against it; so they called it a programming language ...

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

  6. #6
    cselic is offline Senior Member
    Join Date
    Apr 2010
    Location
    Belgrade, Serbia
    Posts
    278
    Rep Power
    6

    Default Re: Why is Java called a programming language?

    Quote Originally Posted by Vinx View Post
    I was watching a Java to C++ tutorial because I was interested in C++, he said "Java is derived from C++" and on some blog I read "Java interprets C++". I guess I should have done more research before asking the question, thank you for clearing this up.
    "Java is derived from C++" means that few geeks was having brainstorming sessions where they were trying to make new programming language that would be similar to C++ but better and easier, for example without allocation/deallocation memory, without pointers, without overloaded operators,...

    ""Java interprets C++"." Main goal of java programming language is that it should be platform independent. Java solves this problem using the concept of Java Virtual Machine (JVM).
    JVM provides a virtual CPU and a virtual instruction set (called byte code).
    The Java compiler transforms a Java source program into byte code.
    A Java interpreter (called Java Runtime) converts the byte code instructions to native processor instructions and executes them.

  7. #7
    FlipPoker@gmail.com is offline Senior Member
    Join Date
    Mar 2011
    Posts
    103
    Rep Power
    0

    Default Re: Why is Java called a programming language?

    Java is a programming language that is both compiled and interpreted.

    A Java program is compiled into bytecodes. These bytecodes are platform-independent. Any Java Virtual Machine (JVM) can interpret these bytecodes, as long as it is a compatible JVM version.

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,043
    Blog Entries
    7
    Rep Power
    23

    Default Re: Why is Java called a programming language?

    Some slight corrections: @cselic: Java does have pointers; each non primitive type variable is a pointer; Java doesn't have pointer arithmetic; @FlipPoker: most (if not all) off the byte code is translated to raw machine code during runtime by the JIT compiler (and the HotSpot engine); my guess is that future Java implementations abandon the HotSpot mechanism completely and leave it all up to the JIT compiler.

    kind regards,

    Jos
    cselic likes this.
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. Replies: 5
    Last Post: 05-21-2012, 10:23 PM
  2. Replies: 9
    Last Post: 03-07-2011, 05:05 AM
  3. Replies: 0
    Last Post: 04-19-2009, 06:38 PM
  4. Creating a new programming language?
    By hawaiifiver in forum Forum Lobby
    Replies: 0
    Last Post: 03-21-2009, 09:46 PM
  5. TOM programming language 2.5
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-14-2007, 08:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •