This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pig.review.jave; | |
public class ConstructorEx1 { | |
public ConstructorEx1 (String name){ | |
System.out.println("Say Hi "+name); | |
} | |
public void play(){ | |
System.out.println("Hello"); | |
} | |
public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pig.review.jave; | |
public class ConstructorEx1 { | |
public ConstructorEx1 (String name){ | |
System.out.println("Say Hi "+name); | |
} | |
public void play(){ | |
System.out.println("Hello"); | |
} | |
public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pig.review.jave; | |
public class CallTestMethodEx1 { | |
public int f(int x){ | |
return 2*x+1; | |
} | |
public static void main(String[] args) { | |
CallTestMethodEx1 obj =new CallTestMethodEx1(); | |
int y =obj.f(5); | |
System.out.println("y="+y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pig.review.jave; | |
public class TestOverLordEx1 { | |
public void add(int x1,int y1){ | |
System.out.println("x1+y1="+(x1+y1)); | |
} | |
public void add(double x2,double y2){ | |
System.out.println("x2+y2="+(x2+y2)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pig.review.jave; | |
class shirt { | |
int price = 2500; | |
char size = 'M'; | |
} | |
public class CallTestReferenceEx1 { | |
public static void main(String[] args) { | |
shirt myShirt = new shirt(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pig.review.jave; | |
public class TestVariableScopeEx1 { | |
int a=1; | |
static int b=2; | |
public void f(int c){ | |
int d=4; | |
System.out.println("a="+a); | |
System.out.println("b="+b); | |
System.out.println("c="+c); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pig.review.jave; | |
public class TestThisEx1 { | |
int x = 1; | |
int y = 3; | |
public void f(int x, int y) { | |
this.x = x; | |
this.y = y; | |
System.out.println("this="+this); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pig.review.jave; | |
public class TestThisEx2 { | |
public TestThisEx2(){//2 | |
this("Mark"); //3 | |
System.out.println("Hello");//6 | |
} | |
public TestThisEx2(String user){//4 | |
System.out.println(user+"you got a mail");//5 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pig.review.jave; | |
public class Test1DimArrayEx1 { | |
public void process(){ | |
int[] data =new int[3]; | |
data[0]=1; | |
data[1]=2; | |
System.out.println("data[0]="+data[0]); | |
System.out.println("data[1]="+data[1]); | |
System.out.println("data[2]="+data[2]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pig.review.jave; | |
public class Test1DimArrayEx2 { | |
public static void main(String[] args) { | |
int data[] = { 1, 2, 3, 4, 5, 6 }; | |
for (int i = 0; i < data.length; i++) { | |
System.out.println("data[" + i + "]=" + data[i]); | |
} |
OlderNewer