java的简单代码_java初学简单代码1.简单的java程序
public class RightAndWrong {
public static void main(String argc[]){
boolean bool = true;
if (bool == false){html代码转链接
System.out.println("This is wrong!");
}
else{
System.out.println("This is right!");
}
}
}
//编译  javac RightAndWrong.java
//运⾏  java RightAndWrong
2.java进阶程序
public class TempTest {
private void test1(int a) {
//做点事情
a ++;
}
public static void main(String args[]) {
TempTest t = new TempTest();
int a = 3;
System.out.println("main⽅法中的a===" + a);
}
}