JAVA(一切为了期末考)

首先是eclipse的使用

https://blog.csdn.net/qq_36243942/article/details/81607906

 

其次是PTA里面Java的格式

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

        Scanner s=new Scanner(System.in);

        int n=s.nextInt();

        int a[]=new int[n];//数组的创建

        for(int i=0;i<n;i++) {

            a[i]=s.nextInt();//输入

        }

        

        System.out.print(j+" "+o);//输出

    }

}

Java父类对象调用子类实体:方法重写与动态调用

class Father{

    public void announce(){

        System.out.println("Father");

    }

}

class Child extends Father{

    @Override//覆盖

    public void announce(){

        System.out.println("Child");

    }

}

public class Hello {

    public static void main(String[] args){

        System.out.println("Hello");

        Father father=new Child();

        father.announce();

    }

}

https://www.cnblogs.com/cielosun/p/6580871.html

http://www.voidcn.com/article/p-mgphykic-cb.html

https://www.cnblogs.com/qbdj/p/10869931.html

 

 

 

猜你喜欢

转载自www.cnblogs.com/noraxu/p/12152151.html