
















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















































.class file Java Virtual Machine .java file Java Compiler Mac Microsoft UNIX
package com.sharadballepu.test; public class HelloWorld { public static void main(String[] args) { HelloWorld hw = new HelloWorld(); hw.display(args[0]); } public void display(String userName) { System.out.println(“Hello ” + userName); } } Compile the program: javac HelloWorld.java Execute the program: java HelloWorld Sharad Output: Hello Sharad
package com.sharadballepu.test; public class HelloWorld { String userName; public static void main(String[] args) { HelloWorld hw = new HelloWorld(); hw.userName = args[0]; } public void display() { System.out.println(“Hello ” + userName); } } Compile the program: javac HelloWorld.java Execute the program: java HelloWorld Sharad Output: Hello Sharad
x = 10 y = new A() method2() method1() main() Stack Heap
13
public ^ ^ private ^ protected ^ default ^ ^ final ^ ^ ^ abstract ^ strictfp ^ transient synchronize d native volatile static ^ ^
16
Operator Description Example == Equality If (i==1) != Non equality If (i != 4)
= Greater than or equal to if ( x >= 4) <= Less than or equal to if ( x <= 4)
Operator Description Example && Conditional and If (a == 4 && b == 5) || Conditional or If (a == 4 || b == 5)