what is java , Learn Java , JAVA
Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platfo...
javaunion.org
public class MyFirstJavaProgram { public static void main(String []args) { System.out.println("Hello World"); } }
public class MyFirstJavaProgram { public static void main(String []args) { System.out.println("Hello World"); } }
Try it Option Online
We have set up the Java Programming environment online, so that you can compile and execute all the available examples online. It gives you confidence in what you are reading and enables you to verify the programs with different options. Feel free to modify any example and execute it online.Try the following example using our online compiler available at CodingGroundpublic class MyFirstJavaProgram { public static void main(String []args) { System.out.println("Hello World"); } }For most of the examples given in this tutorial, you will find a Try it option in our website code sections at the top right corner that will take you to the online compiler. So just make use of it and enjoy your learning.
public class MyFirstJavaProgram { /* This is my first java program. * This will print 'Hello World' as the output */ public static void main(String []args) { System.out.println("Hello World"); // prints Hello World } }
C:\> javac MyFirstJavaProgram.java C:\> java MyFirstJavaProgram Hello World
class FreshJuice { enum FreshJuiceSize{ SMALL, MEDIUM, LARGE } FreshJuiceSize size; } public class FreshJuiceTest { public static void main(String args[]) { FreshJuice juice = new FreshJuice(); juice.size = FreshJuice.FreshJuiceSize.MEDIUM ; System.out.println("Size: " + juice.size); } }
Size: MEDIUM
| abstract | assert | boolean | break |
| byte | case | catch | char |
| class | const | continue | default |
| do | double | else | enum |
| extends | final | finally | float |
| for | goto | if | implements |
| import | instanceof | int | interface |
| long | native | new | package |
| private | protected | public | return |
| short | static | strictfp | super |
| switch | synchronized | this | throw |
| throws | transient | try | void |
| volatile | while |
public class MyFirstJavaProgram { /* This is my first java program. * This will print 'Hello World' as the output * This is an example of multi-line comments. */ public static void main(String []args) { // This is an example of single line comment /* This is also an example of single line comment. */ System.out.println("Hello World"); } }
Hello World
Copyright © 2014 JavaUnion | Distributed by My Blogger Themes