码迷,mamicode.com
首页 > 其他好文 > 详细

作业 刘惠惠

时间:2017-10-09 14:07:30      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:system   incr   tin   ++   src   bre   com   highlight   switch   

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);
  }

 技术分享

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);
  }

 技术分享

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);
  }
}

 技术分享

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("今天星期日"); 
  }
}

 技术分享

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("出错!");
      }
  }
}

 技术分享

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("冬天来了!");
  }
}

 技术分享

作业 刘惠惠

标签:system   incr   tin   ++   src   bre   com   highlight   switch   

原文地址:http://www.cnblogs.com/huiiuh/p/7640600.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!