Monday, December 21, 2009

Reflection in java

  • This API helps to inspect classes, interfaces, field and methods at runtime.
  • It is java API- Reflection
#we can use it for

  • Analyze the capabilities of classes at runtime;
  • Inspect objects at runtime, for example, to write a single toString method that works for all classes;
  • Implement generic array manipulation code; and
  • Take advantage of Method objects that work just like function pointers in languages such as C++.
#Some basics
  • Class class
  • Class c1=e.getClass(); if e is an object of type Employee
  • Date d = new Date(); Class cl = d.getClass(); //It will results java.util.Date
  • e.getClass().newInstance(); helps to create new instance of type Employee
#Using Reflection to Analyze the Capabilities of Classes
  • The three classes Field, Method, and Constructor in the java.lang.reflect package describe the fields, methods, and constructors of a class.
  • all three classes have getName() method will return name of the item,
  • Filed-> getType() will return the type of the filed.
  • there have methods for Method class to get the number of modifiers, return type and modifiers
  • for constructor-> getModifiers(), getDeclaringClass() are among them
# Using Reflection to Analyze Objects at Runtime
  • Employee harry = new Employee("Harry Hacker", 35000, 10, 1, 1989);
Class cl = harry.getClass();
// the class object representing Employee
Field f = cl.getDeclaredField("name");
// the name field of the Employee class
Object v = f.get(harry);
// the value of the name field of the harry object
// i.e., the String object "Harry Hacker"
  • f.setAccessible(true); //if the field is private w can access by calling this.
Share your thoughts

Tuesday, December 15, 2009

Big telecom company: Java/ J2ee interview 12/ Dec/ 2009

# The following lists the interview questions from a big telecom company on december 2009
> JAVA -Senior level position
  • What is the OOPS concepts? And list them
  • What is polymorphism
  • what is the functionalities added into java 1.5 (eg. generic e.t.c)
  • What are the collection interfaces you know? and list them
  • How generic applies to collection interfaces?
  • Design pattern in depth.
  • Garbage collection mechanism
  • Exception handling
> Struts 1.2
  • Process flow of struts
  • What are the files getting created in simple sign-in application in struts?
  • difference b/w struts 2.0
  • diff b/w inculde redirect and include directive
  • How can write method in JSP
  • what are the implicit objects
> Servlet
  • Servlet life cycle.
  • how can servlet communicate with the view layer
  • how may servlet instance will create for 10 requests.
> Hibernate
  • What is hibernate
  • How is the entire architecture for hibernate
  • What is the difference between head and trunc?

Share your thoughts

Monday, December 7, 2009

Here we start

  • This Blog says about different technological topics using Bullets and numbering only.
  • This bullet board brings the advantageous
  1. Get/Understand the contents easily
  2. Important things comes first; So it will be a perfect companion for your exam or interview
  3. Greatest technological topics brings to you
Share your thoughts