9.25
public class Sum
{
public static void main(String[] args)
{
System.out.println("5+5="+5+5);
}
}
public class Increment
{
public static void main(String[] args)
{
int a=3,b;
b=a++;
System.out.println("a="+a+",b="+b);
}
}
public class Short
{
public static void main(String[] args)
{
short s=3;
s+=4;
System.out.println("s="+s);
}
}
public class Count
{
public static void main(String[] args)
{
System.out.println(6&3);
System.out.println(6|3);
System.out.println(6^3);
System.out.println(6<<3);
System.out.println(3<<2);
System.out.println(3>>1);
}
}
public class Countc
{
public static void main(String[] args)
{
int x=0,y;
y=x>1?100:200;
System.out.println("y="+y);
}
}
import java.util.Scanner;
public class ComeputeA
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("输入两个数:");
int a=input.nextInt();
int b=input.nextInt();
a=a>b?a:b;
System.out.println(a);
}
}
import java.util.Scanner;
public class ComeputeB
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("输入三个数:");
int a=input.nextInt();
int b=input.nextInt();
int c=input.nextInt();
a=a>b?a:b;
c=a>c?a:c;
System.out.println(c);
}
}
import java.util.Scanner;
public class WeekDay
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("请输入一个一到七之间的数:");
int weekday=input.nextInt();
if(weekday==1)
System.out.println("今天星期一");
if(weekday==2)
System.out.println("今天星期二");
if(weekday==3)
System.out.println("今天星期三");
if(weekday==4)
System.out.println("今天星期四");
if(weekday==5)
System.out.println("今天星期五");
if(weekday==6)
System.out.println("今天星期六");
if(weekday==7)
System.out.println("今天星期日");
}
}
import java.util.Scanner;
public class SeasonA
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.println("请输入一个数:");
int a=input.nextInt();
switch(a)
{
case 1:
case 2:
System.out.println("冬天来了!");
break;
case 3:
case 4:
case 5:
System.out.println("春天来了!");
break;
case 6:
case 7:
case 8:
System.out.println("夏天来了!");
break;
case 9:
case 10:
case 11:
System.out.println("秋天来了!");
break;
case 12:
default:
System.out.println("出错!");
}
}
}
import java.util.Scanner;
public class Season
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("输入一个月份:");
int a=input.nextInt();
if(a>=3&&a<=5)
System.out.println("春天来了!");
if(a>=6&&a<=8)
System.out.println("夏天来了!");
if(a>=9&&a<=11)
System.out.println("秋天来了!");
if(a>=12&&a<=2)
System.out.println("冬天来了!");
}
}
import java.util.Scanner;
public class Symbol
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.println("请输入两个数:");
int a=input.nextInt();
int b=input.nextInt();
char option='%';
switch(option)
{
case '+':
System.out.println("a+b="+(a+b));
break;
case '-':
System.out.println("a-b="+(a-b));
break;
case '*':
System.out.println("a*b="+(a*b));
break;
case '/':
System.out.println("a/b="+(a/b));
break;
case '%':
System.out.println("a%b="+(a%b));
break;
default:
System.out.println("出错!");
}
}
}
public class Excise
{
public static void main(String[] args)
{
int x=1;
do
{
System.out.println("x="+x);
x++;
}while(x<1);
}
public class ExciseA
{
public static void main(String[] args)
{
int y=1;
while(y<3)
{
System.out.println("y="+y);
y++;
}
}
public class ExciseB
{
public static void main(String[] args)
{
for(int x=1;x<3;x++)
{
System.out.println("x="+x);
}
}
}