| Tech Stuff | Interests | |||||||||||||||||||||
| Tech Stuff... | ||||||||||||||||||||||
| Must know concepts(Source: Thinkg in Java): 1. Where storage lives: Registers:Used by compiler for its needs Stack:Primitive typs, Object references Heap:All Java objects Static Storage: Static variables Constant storage: Directly placed into code. 2. Primitive sizes: These don't change from machine to machine. 3. Garbage collection versus C++ destructors: These are not the same. In Java, finalize() may not be called. However, destructors are always called. 4. Garbage collection schemes: Reference counting, adaptive(stop-and-copy, mark-and-sweep) 5. Order of initialization:static variables are always initialized first, irrespective of where they are placed in the class. 6. package organization: packge is a group of .class files. .class shold exist under the directory structure as specified in the package statement. 7. How java looks for a .class file: If package is not used, class can be run from current directory. However, if package is used, java compiler looks for the directory and sub-directories starting from CLASSPATH directories. 8. protected versus package:These are not same. package limits access for classes to the current package. However, with protected access, inherited classes from a different package can access the methods, variables. 9. Composition versus inheritence: Composition is generally preferred as it gives complete control over what you want to expose. 10. Upcasting/Downcasting: Casting from a derived type to a base type is upcasting. Downcasting happens when you moved down the inheritence hierarchy. 11. Nested classes versus inner classes: A static inner class is a nested class. Pure inner classes are not static and are not visible outside the class to which they are inner. 12. Exceptions: Catched versus runtime 13. Containers: Arrays Collection (contains Iterator) List (contains ListIterator) Arraylist LinkedList Set Hashset Treeset LinkedHashset Map (contains Collection) Hashmap Treemap LinkedHashmap WeakHashmap IdentityHashmap 14. RTTI, Reflection: With RTTI, compiler opens and examines the .class file at compile time. With Reflection, .class file is unavailable at compile time and it is opened and examined by the run-time environment. Top 10 Java programming tips (Source: Effective Java by Joshua Bloch and other books) 1. Do not use Strings when concatenation is required, Use StringBuffer instead. 2. Always use the base type instead of the specific type in parameter lists. Ex: Use Collection instead of ArrayList. 3. Instead of using multiple, overloaded constructors, use static factory methods. 4. Consider composition instead of inheritence. 5. Always use Interfaces to hide your implementation classes. 6. Do not ignore exceptions. 7. Consider using singleton objects. 8. Avoid using reflection as it is expensive. 9. If you are using static members, carefully check the order of declaration. |
||||||||||||||||||||||
| Java | ||||||||||||||||||||||
| Tips & Tricks | ||||||||||||||||||||||
| Links | ||||||||||||||||||||||
| Books | ||||||||||||||||||||||
| J2EE | ||||||||||||||||||||||
| Tips & Tricks | ||||||||||||||||||||||
| Links | ||||||||||||||||||||||
| Books | ||||||||||||||||||||||
| SQL | ||||||||||||||||||||||
| Tips & Tricks | ||||||||||||||||||||||
| Links | ||||||||||||||||||||||
| Books | ||||||||||||||||||||||