java.输出数字

来源:互联网 发布:警方破获网络赌球案 编辑:程序博客网 时间:2024/06/05 14:11
public class Number {      void sort(int a,int b,int c){         int count = 0;          int temp=0;          if(b<a){             temp=a;              a=b;             b=temp;              count++;;             System.out.println("Scheduling results for "+count+" operation:"+a+","+b+","+c);          }          if(c<a){              temp=a;              a=b;              b=temp;              count++;              System.out.println("Scheduling results for "+count+" operation:"+a+","+b+","+c);          }          if(c<b){              temp=b;              b=c;              c=temp;              count++;               System.out.println("Scheduling results for "+count+" operation:"+a+","+b+","+c);          }          if(count==0){               System.out.println("Scheduling results for "+count+" operation:"+a+","+b+","+c);          }                }  }  

import java.util.Scanner; 
public class Example3_1 { 
    public static void main(String args[]){ 
        Scanner reader = new Scanner(System.in); 
        System.out.println("Input three integers, each enter a need to enter the confirmation:");//输入三个整数,每输入一个需回车确认 
        int x =reader.nextInt(); 
        int y =reader.nextInt(); 
        int z =reader.nextInt(); 
        Number number=new Number(); 
        number.sort(x,y,z); 
    } 



0 0
原创粉丝点击