Posts

Question: How object automatically converted into JSON in RESTFull Webservice project? Ans: Spring’s HTTP message converter support, you don’t need to do this conversion manually. Because Jackson 2 is on the classpath, Spring’s MappingJackson2HttpMessageConverter is automatically chosen to convert the Class instance to JSON. For this you have to import the below line import org.codehaus.jackson.map.annotate.JsonSerialize; For RESTFull Service you need to copy following jars and paste them inside WEB-INF -> lib folder in your project. Once you've done that, add those jars to your project build path as well. Into your  project build path as well. asm-3.1.jar jersey-client-1.17.1.jar jersey-core-1.17.1.jar jersey-server-1.17.1.jar jersey-servlet-1.17.1.jar jsr311-api-1.1.1.jar Question : How to retrieving and Accessing Array Values in ResultSet Answer: As with the JDBC 4.0 large object interfaces (Blob, Clob, NClob), you can manipulate ...
Ques) Can we access the non-final local variable inside the local inner class?  Ans:  No Ques) Can we define an interface within the class? Ans:  Yes. class A{    interface Message{     void msg();    }  }    class TestNestedInterface2 implements A.Message{   public void msg(){System.out.println("Hello nested interface");}     public static void main(String args[]){    A.Message message=new TestNestedInterface2();//upcasting here    message.msg();   }  }  Ques) Can we define a class within the interface? Ans:  Yes. If   we define   a   class inside   the   interface, java compiler creates a static nested class. To provide default implementation of an interface we can define a class inside an interface Interface public interface VehicleService { public v...
What is the internal code generated by the compiler for member inner class ? InnerClassDemo.class InnerClassDemo$A.class InnerClassDemo$B.class Java Anonymous Inner Class of a Class Type public class AnonymousClassDemo {   public static void main ( String [] args )   {     Dog dog = new Dog () {       public void someDog ()       {         System . out . println ( "Anonymous Dog" ) ;       }                        } ; // anonymous class body closes here     //dog contains an object of anonymous subclass of Dog.     dog. someDog () ;   } } class Dog {   public void someDog ()   {     System . out . println ( "Classic Dog" ) ; ...
Static method in Thread class static native void yield() static void sleep(long millis, int nanos) throws InterruptedException But the real fact is that you cannot override the static methods. Well, this is very important that the methods have been defined in Thread class and it is always overridden to create different threads. If we allow the sleep and yield methods to be overridden then we will lose the complete functionality or use of the methods. This is why these methods have been made static.      Type Description Member Inner Class A class created within class and outside method. Anonymous Inner Class A class created for implementing interface or extending class. Its name is decided by the java compiler. Local Inner Class A class created within method. Static Nested Class A static class created within class. Nested Interface An inte...