public class jichu{java
public static void main(String[] args){多線程
// 輸出控制檯dom
System.out.print("hello world");ide
}測試
}線程
public class jichu{遊戲
public static void main(String[] args){ci
int number=23;it
String i="我愛你";io
char b=‘女’;
double c=1.45;
//輸出控制檯
System.out.println(number);
System.out.println(i);
Ststem.out.print(b);
System.out.print(c);
}
}
public class jichu{
public static void main(String[] args){
String brand="愛國者F928";
String type="內置鋰電池";
double weight=12.4;
int price=499;
//輸出控制檯
System.out.println("品牌:"+brand);
System.out.println("重量:"+weight);
System.out.println("電池類型:"+price);
System.out.println("價格:"+type);
}
}
public class jichu{
public static void main(String[] args){
int A=80;
//int B=80;
//同類型的能夠賦值
int B=A;
System.out.println(B);
}
}
public class jichu{
public static void main(String[] args){
int Java=90;
int STB=89;
int SQL=60;
int AA=Java-SQl;
int sum=Java+SQL+STB;
int avg=sum/3;
System.out.println(AA);
// 非數值 數值
System.out.println("平均分"+avg);
}
}
public class jichu{
public static void main(String[] ards){
int days=46;
int week=7;
int weekend=days/week;
int date=days%week;
System.out.println("剩餘"+date+"天");
System.out.println("有"+weekend+"周");
}
}
public class jichu{
public static void main(String[] args){
int A=5;
double AA=1.3;
double sum=A+AA;
System.out.println(sum);
}
}
public class jichu{
public static void mian(String[] args){
String A="與";
char B='男';
char V='女';
String sum=A+B+V;
System.out.println();
}
}
public class jichu{
public static void main(String[] args){
int year=20;
double f=9.8;
int B=(year+(int)9.8)
System.out.println(B);
}
}
import java.util.Scanner;
public class jichu{
public static void main(String[] args){
Scanner in=new Scanner(System.in);//輸入設備
System.out.println("請輸入你的姓名:");
String name=in.next();
System.out.println("請輸入你的年齡:");
int age=in.nextInt();
System.out.println("姓名:"+name);
system.out.println("年齡:"+age);
}
}
public class jichu{
public static void main(String[] args){
int radius=10;
double high=1.9;
int value=(int)(3.14*radius*radius*high);
System.out.println();
}
}
public class jichu{
public static void main(String[] args){
int num1=19;
int num2=89;
int temp;
temp=num1; num1=num2; num2=temp;
System.out.println("temp的值:"+temp);
System.out.println("num1的值:"+num1);
SyStem.out.println("num2的值:"+num2);
}
}
public class jichu{
public static voiod main(String[] args){
int A=2;
int B=2;
boolean flag;
A==B;
flag=A==B;
System.out.println(flag);
}
}/*
>大於
<小於
!= 不等於
== 等於
<= 小於等於
>= 大於等於
*/
import java.util.Scanner;
import java.util.*;
public class jichu{
public static void main(Strimng[] args){
Scanner in=new Scanner(System.in);
System.out.println("請輸入你的成績:");
int score=in.nextInt();
//if(score>90){
if (score>90==false) {
System.out.println("獎勵一本書");
}
System.out.println("正在測試");
}
}
import java.util.Scanner;
public class jichu{
public static void main(String[] args){
Scanner in=new Scaner(Sysytem.in);
System.out.println("請輸入你的JAVA成績:");
int Java=in.nextInt();
System.out.println("請輸入你的SQL成績:");
int SQL=in.nextInt();
// if(Java>90&&SQL>90){
if(!(Java>90)&&SQL>90){
System.out.println("送你一本書");
}
}
System.out.println("測試");
}
}
public class jichu{ //3+4*5=23
public static void main(String[] args){
if(!(4>5)&&5>4||4>3){
System.out.println("成立");
}
}
public class jichu{
public static void main(String[] args){
Scanner in=new Scanner(System.in);
System.out.println("請輸入你的成績:");
int scone= in.nextInt();
// if (scone>=90) {
// System.out.println("優秀");
// }
// if (scone>=80&&scone<90) {
// System.out.println("良好");
// }
// if(scone>=60&&scone<80){
// System.out.println("及格");
// }
// if (scone<60) {
// System.out.println("不及格");
// }
// System.out.println("測試");
if (scone>=90) {
System.out.println("優秀");
}else if (scone>=80) {
System.out.println("良好");
}else if (scone>=60) {
System.out.println("及格");
}else{
System.out.println("不及格");
}
System.out.println("測試");
}
}
import java.util.Scanner;
public class jichu{
public static void main(String[] args){
Scanner in=new Scanner(System.in);
System.out.println("請問你的性別是?(boy/girl)");
String sex=in.next();
if(sex.equals("boy")){
//if(sex=="boy"){
System.out.println("你的年齡多少歲?");
int age=in.nextInt();
if(age>=18){
System.out.println("成年");
}
}else{
System.out.println("未成年");
}
}else{
System.out.println("原來是一位girl");
}
}
}
import java.util.*;
public class jichu{
public static void main(String[] args){
Scanner in=new Scanner(SyStem.in);
System.out.println("請輸入你的名次:");
int mingci=in.nextInt();
//char mingci='女';
// if(mingci==1){
// System.out.println("出任盟主");
// }
// if(mingci==2){
// System.out.println("出任掌門");
// }
// if(mingci==3){
// System.out.println("出任師傅");
// }
// if(mingci>3){
// System.out.println("出任守山大弟子");
// }
switch(mingci){ // 開關
case 1:// 案例
//case '女':
System.out.println("出任盟主");
break;// 跳出
case 2:
System.out.println("出任掌門");
break;
case 3:
System.out.println("出任師傅");
break;
default:// 默認
System.out.println("出任守山大弟子");
}
}
}
public class jichu{
public static void main(String[] args){
}
}
//奇數偶數
import java.util.*;
public class jichu{
public static void main(String[] args){
Scnaner in=new Scanner(System.in);
Sysytem.out.println("輸入一個數:");
int number=in.nextInt();
if(number==0){
System.out.println("請不要輸入0,咱們只計算正整數的偶數!");
}
else{
if(number%2==0){
System.out.println(number+"是一個偶數!");
}
else{
System.out.println(number+"是一個奇數!");
}
}
}
}
import java.util.*;
public class jichu{
public static void main(String[] args){
Scanner in=new Scanner(System.in);
System.out.println("輸入年份:");
int i=in.nextint();
if (i%4==0&&i/100!=0||i%400==0) {
System.out.println(i+"是一個瑞年");
}else{
System.out.println(i+"是一個平年");
}
}
}
import java.util.Random;
public class jichu{
public static void main(String[] args){
Random c=new.Random();
int number=c.nextInt(10);//0~9的隨機數;
System.out.println("隨機數"+number);
}
}
public class jichu{
public static void main(StringP[] args){
// System.out.println(Math.random()*10);
//隨機數0~9;
// 可是double類型的數
int number=(int)(Math.random()*10);
System.out.println("隨機數是:"+number);
//支持多線程的
}
}
import java.util.Scanner;
import java.util.Random;
public class jichu{
public static void main(String[] args){
Scanner in=new Scanner(System.in);
System.out.println("------猜拳遊戲--------");
System.out.println("請出( 1.剪刀 2.石頭 3.布)");
int person=in.nextInt();
int computer(int)(Math.random()*3)+1;
String P="拳頭";//作一個標記
String C="拳頭"
// System.out.println(computer);
switch(person){
case 1:
P="剪刀";
break;
case 2:
P="石頭";
break;
case 3:
P="布";
break;
}
switch(computer){
case 1:
C="剪刀";
break;
case 2:
C="石頭";
break;
case 3:
C="布";
break;
}
if (person==1&&computer==1) {
System.out.println("平局"+P+"電腦出的是"+C);
}else if(person==1&&computer==2||person==2&&computer==3||person==3&&computer==1){
System.out.println("你出的是:"+P+"電腦出的是"+C+"你輸了");
}else{
System.out.println("你出的是:"+P+"電腦出的是"+C+"你贏了");
}
}
}