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.
http://i.imgur.com/3IoMR.png
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.
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:
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
Re: Why is Java called a programming language?
Quote:
Originally Posted by
cselic
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.
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...
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
Re: Why is Java called a programming language?
Quote:
Originally Posted by
Vinx
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.
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.
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