Follow TV Tropes

Following

Media Notes / Java

Go To

https://static.tvtropes.org/pmwiki/pub/images/6622ce31_69f0_4ecc_b95b_aca123c54bda.jpeg

3 BILLION DEVICES Run Java
—Oracle, Java Install Screen

Java is an Imperative, Object-Oriented, Class-Based Programming Language.

It was created in 1991 and lead by Sun Microsystems Employee, James Gosling. Its design philosophy was greatly influenced by C and C++ due to its syntax being so familiar with programmers. Sun released the first public implementation in 1996, and promised that Java could run anywhere without having to change any code. Soon, major browsers added the ability to run small Java applets. Java began to grow in popularity. Between 2009-2010, Oracle acquired Sun Microsystems.

Rather than being compiled to a particular type of machine code, Java programs are compiled into 'bytecode' and can be run by the Java Virtual Machine (JVM). This type of compiling isn't unique to Java and Sun did not invent it.

Java is also the main language for Android application development. Android OS doesn't use the Java Virtual Machine to execute code. Rather, Google developed its own program, Android Run Time, to run Java code. This was the basis for the lawsuit with Oracle.

Note that Java, the programming language, is different from Java, the platform, which is discussed in greater detail in the Java Software Platform page.

Not to be confused with JavaScript.


    Code Examples 

Hello World App

public class fileName {
    public static void main(String[] a){
System.out.println("Hello World!");
    }
}

This program outputs "Hello World" to the console. Note that fileName should be replaced with the actual name the file was titled.

Variable Declaration and Concatenation

public class fileName {
    public static void main(String[] a){
int a = 10;
int b = 7;
String c = "Bob";
System.out.println(a + b);
//will output 17
System.out.println(b + c);
//will output 7Bob
System.out.println("hello, " + c);
//will output hello, Bob
    }
}

Variables declarations must match their type and failing to do this will cause the compiler to throw an error. Java will concatenate if one or both types are strings, otherwise, Java will add the numbers.

For Loops

public class fileName {
    public static void main(String[] a){
for(int i=0;i<10;i++){
    System.out.println(i);
}
    }
}

This program will output the numbers 0 thru 9 in the console. Java uses a C-like For Loop.

Works that are written in the Java Programming Language

    Video Games 


Alternative Title(s): Java Programming

Top