java note

java note
1. Java main function must be public static void main(String[] args){}
2. Class decorator can be public or null. example: public class Main{} or class Main{}
3. Class name must be the same as file name (and one file only include one class at most), otherwise raise error can't find specific class when call specific class. example: Main.java file include public class Main{} or nothing.
4. Abstract class: abstract classes are classes that contain one or more abstract methods which don’t have method bodies. example: in public abstract ClassAbstract(){} include method public abstract void methodAbstract();. another class inherit from it. example: public ClassInherit extends ClassAbstract, and implement the abstract method: public void methodAbastract(){ do something };.
5. Interface class is a 100% abstract class (all method don't have method body). example: public interface InterfaceClass{ public abstract void AbstractOne(); public abstract void AbstractTwo();}. and implement class: class Impl implement InterfaceClass{ public void AbstractOne(){ do something }; }.

main method: https://stackoverflow.com/questions/29276917/what-does-public-static-void-main-args-mean

abstract class: https://stackoverflow.com/questions/6007089/how-and-when-to-use-an-abstract-class

interface class: https://www.sitepoint.com/interface-and-inheritance-in-java-interface/

原文地址:https://www.cnblogs.com/vickey-wu/p/8243211.html