JAVA作业。

package a;

public class ab {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int a = 1;
        int b = 2;
        int c = a;
        a = b;
        b = c;
        System.out.println(a);
        System.out.println(b);

    }

}

2.public static void main(String[] args) {
int i=1000;
int a=i/1000;
int b=i/100%10;
int c=i/10%10;
int d=i%10;
System.out.println(a+b+c+d);
}
}

 

 3.package a;

public class ab {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        float s=22.0f;
        float f=222.0f;
        float sTof=(f-32)*5/9;
        float fToc=s*9/5+32;
        System.out.println("摄氏转华氏="+sTof);
        System.out.println("华氏转摄氏="+fToc);
        }
    }

 

4.package a;

public class ab {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        char c='A';
        System.out.println((char)(c+32));
        }
    }

 

posted @ 2020-03-19 12:00  ahuhah  阅读(151)  评论(0编辑  收藏  举报