摘要:
Java File Handling The File class from the java.io package, allows us to work with files. import java.io.File; // Import the File class File myObj = n 阅读全文
摘要:
import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<Integer> numbers = new ArrayList<Integer>(); number 阅读全文
摘要:
Threads allows a program to operate more efficiently by doing multiple things at the same time. Creating a Thread There are two ways to create a threa 阅读全文
摘要:
Pattern Class - Defines a pattern (to be used in a search) Matcher Class - Used to search for the pattern PatternSyntaxException Class - Indicates syn 阅读全文
摘要:
try and catch 确切的说这应该是Exception。因为Error是指Java虚拟机无法解决的严重问题,如stack溢出,堆溢出... Use try and catch: 可以写多个catch来捕捉不同的exception类型 public class Main { public st 阅读全文
摘要:
Wrapper classes provide a way to use primitive data types (int, boolean, etc..) as objects. Primitive Data TypeWrapper Class byte Byte short Short int 阅读全文
摘要:
An Iterator is an object that can be used to loop through collections, like ArrayList and HashSet. // Import the ArrayList class and the Iterator clas 阅读全文
摘要:
A HashSet is a collection of items where every item is unique, and it is found in the java.util package: import java.util.HashSet; // Import the HashS 阅读全文
摘要:
A HashMap however, store items in "key/value" pairs, and you can access them by an index of another type (e.g. a String). Create a HashMap object call 阅读全文
摘要:
The LinkedList class is almost identical to the ArrayList: import java.util.LinkedList; public class Main { public static void main(String[] args) { L 阅读全文