作业 刘惠惠

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了作业 刘惠惠相关的知识,希望对你有一定的参考价值。

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

 技术分享

以上是关于作业 刘惠惠的主要内容,如果未能解决你的问题,请参考以下文章

10.9作业造人 刘惠惠

10.23作业 刘惠惠

刘惠惠1.2

刘惠惠1.8

刘惠惠1.12

刘惠惠2.6,2.15