Thursday, October 1

Points to remember about Java


1. It is important that the name of the file match the name of the class and the extension be .java.
2. All functions (methods) in Java must be of some class.
3. Member functions are called methods in Java.
4. Creating two methods woth the same name but different arguements is called method overloading.
5. Method overloading allows set to methods with very similar purpose to be given the same name.
6. When a method makes an unqualified reference to another member of the same class, there is an implicit r reference to this object.
7. Java does not provide a default constructor of the class defines a constructor of its own.
8. When present, package must be the first noncomment statement in the file.
9. The import statement must follow the package statment but must also precede all other noncomment statements.
10. The full method or class name, including the package name, must be used when two imported packages contain a method or class with the same name.
11. Due to security reasons, it is not possible to perform file I/O operations from an applet.
12. When a simple type is passed to a method, it is dine by use of call-by-value. Objects are passed by use of call-by-reference.
13. It is illegal to refer to any instance variables inside of a static method.
14. All command-line arguements are passed as strings. We must therefore convert numeric values to their original forms manually.
15. A class member declared as private will remain private to its class. It is not accessible by any code outside its class, including subclasses.
16. The star form of import statement may increase compile time. It will be good practice to explicitly name the classes that we want to use rather than importing whole packages.
17. Interfaces add most of the functionality that is require for many applications which would normally require the use of multiple inheritance in C++.
18. When we implement an interface method, it must be declared as public.
19. If a finally block is associated with a try, the finally will be executed upon conclusion of the try.
20. Java uses pointers (addresses) intenally to store reference to objects, and for elements of any array of objects, However, these pointers are not available for use by programmers.
21. We cannot overload methods with differences only in their return type.
22. When a method with the same signature occurs in both the super class and its subclass, the method in the subclass overrides the method in he super class.
23. Every constructors must invoke its super class constructor in its first statement. Otherwise, the default constructor of the super class will be called.
24. A class marked as final cannot be inherited.
25. A method marked final cannot be overridden.
26. Subclasses of an abstract class that do not provide an implementation of an abstract method, are also abstract.


No comments: