Java Language
The Java language has its own structure, syntax rules, and programming paradigm like any programming language. The Java language's programming paradigm is based on the concept of OOP, which the language's features support.Java Compilation
When you write program for the Java platform, you write source code in .java files and then compile them. The compiler checks your code against the language's syntax rules, then writes out byte code in .class files. Byte code is a set of instructions targeted to run on a Java virtual machine (JVM). In adding this level of abstraction, the Java compiler differs from other language compilers, which write out instructions suitable for the CPU chipset the program will run on.Let's Follow these steps how to save the file, compile and run the program.
- Open notepad and add the code to print "Hello World" as an output.
- Save the file as: MyFirstJavaProgram.java.
- Open a command prompt window and go to the directory where you saved the class. Assume its C:\.
- Type ' javac MyFirstJavaProgram.java' and press enter to compile your code. If there are no errors in your code, the command prompt will take you to the next line (Assumption: The path variable is set).
- Now, type ' java MyFirstJavaProgram ' to run your program.
C :\> javac MyFirstJavaProgram.java
C :\> java MyFirstJavaProgram
Hello World
If you like this post then please share and visit this post.
Visit us @ tccicomputercoaching.com
Call us @ 98256 18292
No comments:
Post a Comment