Java #1

20180925  by TonyQ 

開發環境

intelJ
JDK 10

public class  Test{
     public static void main(String[] args){
           //要執行的程式碼放這裡
     }
}

//Test.java

variable

變數

int

int a= 10;

System.out.println((a/3));  //請問這會印出?

int b = 10;

System.out.println(a+b); //印出?

double

double a = 5.0;

System.out.println((a/3));  //請問這會印出?

int b = 10;

System.out.println(a+b); //印出?

System.out.println((a/3.0));  //請問這會印出?

String

String  str = "這是一個字串";

String  b = "。句號";

System.out.println(str+b); // 印出?

Date

Date a = new Date();
//當前時間

System.out.println(a.toString());

Date b = new Date("2018-12-33");
System.out.println(b.toString()); //???

排列組合時間

  • int + double?   (1+0.5)
  • int + string ?   (1+"123")
  • string + date? 
  • int + date ?
  • double + string ? 

 

Scanner scan= new Scanner(System.in);


int a  = scan.nextInt();

int b = scan.nextInt();


System.out.println(a*b);

Java #1

By TonyQ Wang

Java #1

  • 650
Loading comments...

More from TonyQ Wang