Packages : package, import, static import
A java package allows you to collect a group of files, so that they can be used with another set of files without you needing to worry about naming conflicts. A static import allows you to include constants without you needing to qualify them, however it can lead to problems if the file changes.
Using Classes : class, object, null, interface, fields, enum, abstract, extends, implements, private, protected, public, this, super, new, toString, equals, polymorphic Java is a class based language, it is similar to C++ but it is missing multiple base classes, instead you use interfaces and implement them to get the same effect. You can use extends to derive a sub class from the super class, and then change the behavior on the sub class. For example, if you have an Animal base class, with a noise method, a dog object, would bark, and a cat object would meow. Private is used when a method or field can not be manipulated directly, say you have a bank account class, the balance would be a private field, since
you don't want people to be able to change the value unless they are making a deposit or a withdrawal, which would be public methods. The object class is the class that all other classes inherit from, and means that there are certain methods that any object will support. The methods include toString which is used to provide a string representation of the object (it's normally human readable, although it doesn't have to be). Another method is equals, which is used so that you can compare two objects to see if they are the same, hashCode is used to provide a representation that can be used if you want to put the object into a set or some other collections. An abstract class is a class that represents something that can't be created, for example you might have an abstract shape class, with sub classes such as circle and triangle. The shape class may have a method draw, which is abstract that means sub classes are expected to implement it. To access fields inside a method, you can use "this" to access the current object (a lot of the time, it is implicit and you can ignore it). You creat an instance of a class with the new operator, and that calls the constructor for the object and allocates the memory.
Functions : virtual, static, arguements
Java supports methods with multiple arguements, you can have a method with the same name but with different arguements and it will still work correctly (thi is different than C, but works the same as C++). A static method, does not need to refer to an existing object, and a virtual method is one where you call the method based on the class of the object, so you can use the noise method from the class animal, and it will call the method defined in the dog or cat class, depending on the type of the object.
Exception handling : exception, try, catch, finally
Exceptions are a way of signalling errors, in C it was traditional to use error codes as return codes from functions, but the value was often ignored. Exceptions provide a way of forcing the error to be handled (or at least allows the system to display an error message if it is not caught). The finally statement is used so that you can make, some code is called, even if an exception is thrown. This can be used to close a file that has been opened, or a network connection to be closed.
Collections : Set, List, Map, HashMap, HashSet, LinkedList, TreeSet, add, addAll, contains
Java has a set of collection classes, which are similar to the STL in C++. There are abstract collections, such as Set, and List which provide an interface and implementations such as TreeSet and ArrayList. There are methods such as contains which are provided by all the collections, although the speed of checking contains depends on the type of collection, a TreeSet is much faster than an ArrayList. Sets are unordered whilst Lists are ordered, which means if you insert the values 1,2,3 into a Set and into a List, then you can get them back in the same order from a List, but from a Set the order is not preserved, so you can tell you have those values, but you can't say anything about the order they were added to the Set. All the collections have a size() method to count how many elements there are present in the collection, along with clear() and isEmpty(). Sets and Lists have an add() function to add an element to the collection, whilst Maps have a put() method instead which takes a key along with the value. A Map allows you to associate an element with a value, so you could have a list of employees stored in a Map, using their name as a key, and you could look at the employee object for a given name efficiently. If you want to store items in a collection you should implement hashCode and equals for the class of objects you wish to store.
Handling Files : BufferedReader, FileReader, File, readLine, delete, exists, read, write Java supports a rich variety of file handling, with the ability to read and write to files, to check if a file exists, to delete a file, to create a directory. It uses exception handling to report on errors, and has a number of wrapper classes to simplify access. Such as BufferedReader, which provides a more efficient handling of files.