Part 3 Video Notes
Part 4: Commnets in Java Programming
Use of comments: For understandability, To Stop/Pause the execution temporarily so that part gets run for testing
Sinlge line comments: //
Multi line comments: starts with /* ends with */
Documentation comments: starts with /** ends with */ This helps in API documentation
Part 5: Understanding First Java Program
We store program with .java extension. Aswe already set class path we can store in any editor. Prefer using some e
Entire program will always be in class boundary i.e. each line shall be with in class curly braces
Execution of each program starts from main method. If no main method program won't run
program name .java file name shall be equal to main method. Because program searches for it
Main method syntax: public static void main (String args[])
To touch a method/variable we need to create an object first, it’s a must. To access with out that we hav
sometimes we may not write return statement then in such cases we must write void. Main metohd gen
String array allows us to pass input values to the main method by helping to store those input
To print anything: System.out.println("Hello World, Welcome")
step1 To compile anything: we need to write javac command. Eg javac programname.java
step2 To Execute just write java programname
Note: If classpath is not setup properly and tried running program below error comes
JIT: Just In Time compilter
Program stores in Method area
Created objects get stored in Heap Area
Created temporary variables or temp results get stored in Java Stack area
PC registers stores the addresses of programs/methods in method area
Native Methods allows to import few things from other languages like C, C++. Other lanaguages stored in
interpreter & JIT compiler together converts .class file to binary code (because these two its much faster
o that part gets run for testing
umentation
ny editor. Prefer using some editor like notepad ++
To access with out that we have to write static
t write void. Main metohd generally won't return anything hence void
o store those input
rogramname.java
n Time compilter
stores in Method area
bjects get stored in Heap Area
emporary variables or temp results get stored in Java Stack area
rs stores the addresses of programs/methods in method area
ethods allows to import few things from other languages like C, C++. Other lanaguages stored in Native Stack area
er & JIT compiler together converts .class file to binary code (because these two its much faster)
eturn anything hence void
Tip: To hide/see extensions of files stores in search type folder options >> it gives file
explorer options
then in view try to check or uncheck 'Hide extensions for known file types'
Part 6: Data Types in Java
Variable is name of memory location in which values are stored
Data type indicates what type of data to be stored by the variable
1 byte = 8 bits -> Rane = -128 to 127 (-2 power 7 to 2 power 7)
short = 16 bits (-2 power 15 to 2 power 15)
int = 32 bits (-2 power to 31 to 2 power 31)
Float : after decimal uptil 7 digits (called single precision)
double: after decimal uptil 15 digits (called double precision)
char a = 'x' (0 to 65535 ascii value)
String myname = "GKS";
boolean a = true
boolean b=false