能来得及就见鬼了…
(今日份暴躁Tianna)
![](https://i-blog.csdnimg.cn/blog_migrate/5c3bb25274869972627ec12d61b07c95.jpeg#pic_center)
Practice Quiz
Compile & Run
√ javac test1.java test2.java; java test1.java
√ javac *.java; java test1
× javac test1.java test2.java; java test1.class
Overload - method
- Invalid: different return type:
int Tianna(int a, String b)
double Tianna(int a, String b)
- Valid:
- Different number of parameters
int Tianna(int a, int b)
int Tianna(int a, int b, int c)
- Different type of parameters
int Tianna(int a, int b)
int Tianna(int a, String b)
- Different sequence of type of parameters
int Tianna(int a, String b)
int Tianna(String a, int b)
Hashmap
- Traverse the map:
for(HashMap.Entry<Integer,String> element : map.entrySet()){
System.out.println(element.getKey() + " --> " + element.getValue());
}
Notes
Superclass & Subclass
- Subclass cannot be constructed using a superclass constructor
√ Superclass a = new Subclass();
× Subclass a = new Superclass();
I/O
import java.io.File;
import java.util.Scanner;
import java.io.PrintWriter;
import java.io.FileNotFoundException;