1. What is Java?
Java is a programming language and a platform.
Java is a high level, robust, object-oriented and secure programming
language.
Java was developed by Sun Microsystems (which is now the subsidiary of
Oracle) in the year 1995.
James Gosling is known as the father of Java. Before Java, its name
was Oak. Since Oak was already a registered company, so James Gosling and
his team changed the name from Oak to Java.
4. program
- set of instructions to perform a task
- input - process - output
- task=> subtasks (funs)
- write funs to solve subtasks
- funSubtask1PrintBanner(input-
size,content,money)
- steps / logic
- process
- output - BannerIsReady
- funSubtask2Calls(inputs)
- steps / logic / process
- output
- main()
- funSubtask1PrintBanner()
- funSubtask2Calls()
- funSubtask2Calls()
5. public :It Is Access Specifier ,Main Method Can Be Accessed
Anywhere
static :It Can Be Accessed Without Object.
void :It Does Not Return Any Value
main :Every Program Starts With Main And Ends With Main
String :String Is Only The Type Which Can Hold Any Type Of Data
And Later It Can Be Converted To Any Type.
public static void main( String Ob[]): it Is Being Registered To The
Compiler.
6. System. out. println :It Is Used To Print The Output.
System :It Is A Class
out :It Is An Object Of Print stream Class And Defined As Static Field In
System Class
Println :It Is A Method Of Printstream Class And It Is Used To Print The
Output.
Java Program Can Be Written In 2 Ways
1.Write The Program In Any Text Editor Compile And Execute In The
Command Prompt
2.Write,compile And Execute In Any Java Enabled IDE (integrated
Development Environment) like Eclipse Intellij Netbeans Visual Studio
Code Code Blocks ... ... ...
7. Notes For Writing A Program In Java::
1. One Application Can Have Only One Main Method
2. Main Class Name And The Filename Should Be The Same
3. All The Executable Statements Should Be Terminated With Semicolon
4. Java Is Case Sensitive.(Capital Letters Are Different From Small Letters)
How To Compile A Java Program ?
javac Filename
javac Sample.java
javac - (Java Compiler):
On Successful Compilation ,It Creates A .Class File With The Classname.
How To Execute A Program ?
java Classnamejava(it Is The Java Interpreter ) It Is Used To Execute The Java
Program.Set Path:It Makes All The Exe Files Of The Directory Available To The Prompt
Syntax
set path= newpath :it removes all the existing path and sets the new path.
set path=%path%;newpath :it append the newpath to the existing path
set path= newpath;%path%;
set classpath : it makes all the class or jar files of the directory available to the
prompt.