栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

middle-term-review-java

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

middle-term-review-java

 final float a=3.14f;//常量的定义
        double c=312.122;
        int b=100000;
        System.out.printf("%e",a);//格式化输出
        System.out.printf("%E",c);//格式化输出
      
        System.out.printf("%.2f",c);
        System.out.println();

      
        double x=3.1415926; 
        String s=String.format("%.2fn",x);
        System.out.print(s);

        x=x*Math.PI;
        System.out.println("Math.PI test: "+x);

        int year = 2020;
        System.out.printf("%8d%n",year);//右对齐,长度为8

        JOptionPane.showMessageDialog(null,"x=3n"+"y=0n"+c);
            System.exit(19);
//middle term review
import javax.swing.*;
public class review_middle {
    public static void main(String[] args) {
        int year = 2020;
        String s="huahuhu";
        System.out.println(s);
        s=String.valueOf(year);
        System.out.println(s);

        String s0="12";
        System.out.println(s0);
        int x=Integer.parseInt(s0);
        System.out.println(s0);
    }
}

//middle term review
import javax.swing.*;
class father{
    private int a;
    public void eat(){
        System.out.println("father");
    }
}
class son1 extends father{
    public void eat(){
        System.out.println("son1");
    }
    public void s1(){
        System.out.println("s1 special");
    }
}
class son2 extends father{
    public void eat(){
        System.out.println("son2");
    }
    public void s2(){
        System.out.println("s2 special");
    }
}
public class review_middle {
    public static void main(String[] args) {
        father f1=new son2();
        f1.eat();//son2
        //f1.s2();//报错
        father f2=new son1();
        son1 ss=(son1) f2;
        f2.eat();
        //f2.s1();//报错
    }
}

重要!!
//middle term review
import javax.swing.*;
public class review_middle {
    public static void main(String[] args) {
        String str="dasdgsddsdd,fdsdf,111";
        String[]sp=str.split(",",2);
        for(int i=0;i
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/362337.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号