king420 Posted June 19, 2013 Report Share Posted June 19, 2013 [quote name='cherlapalli_jailer' timestamp='1371679636' post='1303871840'] String is immutable StringBuffer is mutable.. is the simple answer.. waht we do normally is String str = new String() ; Str = Str +"1" //like looping ; or Str = "1" + str ; litterly every time we are reframing the value of string where as StringBuffer sb = new StringBuffer() ; sb.append("1") ; thats all we are appened new value every time to exisitng [/quote] okka mukka kuda ardam kaala...append entiii ee gola entiii naaku clear ga cheppu mayyaa Link to comment Share on other sites More sharing options...
chinni005 Posted June 19, 2013 Report Share Posted June 19, 2013 Dependency Injection: 1.loose coupling and tight coupling: all classes in springs are singleton coz they don't dependent on other classes.. this is called lightly coupled. Usually java doesn't like classes to be tightly coupled with each other it means it doesn't like the classes to be dependent on other class. to avoid this dependency we use Springs. for example: Case1: Traveller Class class Traveller{ p.s.v.m(String[] args()){ Car car = new car(); car.move(); } } Car class public static class Car{ public void move(){ s.o.pln("basic car moves") } } so in the above example if u want to replace the car class with any other class, say u want a Honda which is a car too instead of Car itself, this change will effect Traveller Class as we have instance of car class, so in short any changes in class Car would effect changes in class Traveller. which means Car class is tightly coupled to Traveller class which is not acceptable and not encouraged while developing big applications. Solution is: We can create an Interface and then implement it and the class traveller creates reference to the interface Case2: Class Traveller{ p s v m (String[] args()){ Vehicle v = new car(); v.move(); } } interface Vehicle{ void move(); } class Car Implements Vehicle{ public void move(){ s.o.pln("move"); } } but still the Traveller class depends upon the new car instance i.e., the car class, So, still these classes are tightly coupled with each other. So, for cases like this Springs came up with an extraordinary feature to rescue, when we configure concrete classes with sprig configuration file and referring the object to the interface type as in above case2. Case3: We are creating the spring configuration file by Spring framework container i.e., "APPLICATION CONTAINER" we use ApplicationContext in this case. public class Traveller{ psvm(String[] args()){ Applicationcontext ctx = new ClassPathXmlApplicationContext("Spring.xml"); [size=4]Vehicle v = (Vehicle) ctx.getBean("vehicle");[/size] v.move(); } } Spring.xml is the Spring ConfigurationFile which has <bean id = "Vehicle" class ="Car"/> id is Interface and class is Car class, so with this framework we can easily change the class to Car/MotorCycle or whatever class and just configure this spring file to the Application Context i.e., Spring Container. Spring Framework: It the light weight Dependency Injection and Aspect oriented Container and framework. As a container Spring helps in creating the objects and managing the wiring b/w the objects and also the life cycle of the object. The basic concept of the Inversion of Control pattern (also known as dependency injection) is that you do not create your objects but describe how they should be created. You don't directly connect your components and services together in code but describe which services are needed by which components in a configuration file. A container (in the case of the Spring framework, the IOC container) is then responsible for hooking it all up. i.e., Applying IoC, objects are given their dependencies at creation time by some external entity that coordinates each object in the system. That is, dependencies are injected into objects. So, IoC means an inversion of responsibility with regard to how an object obtains references to collaborating objects. What are the different types of IOC (dependency injection) ? There are three types of dependency injection: Constructor Injection (e.g. Pico container, Spring etc): Dependencies are provided as constructor parameters. Setter Injection (e.g. Spring): Dependencies are assigned through JavaBeans properties (ex: setter methods). Interface Injection (e.g. Avalon): Injection is done through an interface. Note: Spring supports only Constructor and Setter Injection Spring framework overview at very high level Link to comment Share on other sites More sharing options...
king420 Posted June 19, 2013 Report Share Posted June 19, 2013 [quote name='Chinni_' timestamp='1371680760' post='1303871879'] Dependency Injection: 1.loose coupling and tight coupling: all classes in springs are singleton coz they don't dependent on other classes.. this is called lightly coupled. Usually java doesn't like classes to be tightly coupled with each other it means it doesn't like the classes to be dependent on other class. to avoid this dependency we use Springs. for example: Case1: Traveller Class class Traveller{ p.s.v.m(String[] args()){ Car car = new car(); car.move(); } } Car class public static class Car{ public void move(){ s.o.pln("basic car moves") } } so in the above example if u want to replace the car class with any other class, say u want a Honda which is a car too instead of Car itself, this change will effect Traveller Class as we have instance of car class, so in short any changes in class Car would effect changes in class Traveller. which means Car class is tightly coupled to Traveller class which is not acceptable and not encouraged while developing big applications. Solution is: We can create an Interface and then implement it and the class traveller creates reference to the interface Case2: Class Traveller{ p s v m (String[] args()){ Vehicle v = new car(); v.move(); } } interface Vehicle{ void move(); } class Car Implements Vehicle{ public void move(){ s.o.pln("move"); } } but still the Traveller class depends upon the new car instance i.e., the car class, So, still these classes are tightly coupled with each other. So, for cases like this Springs came up with an extraordinary feature to rescue, when we configure concrete classes with sprig configuration file and referring the object to the interface type as in above case2. Case3: We are creating the spring configuration file by Spring framework container i.e., "APPLICATION CONTAINER" we use ApplicationContext in this case. public class Traveller{ psvm(String[] args()){ Applicationcontext ctx = new ClassPathXmlApplicationContext("Spring.xml"); [size=4]Vehicle v = (Vehicle) ctx.getBean("vehicle");[/size] v.move(); } } Spring.xml is the Spring ConfigurationFile which has <bean id = "Vehicle" class ="Car"/> id is Interface and class is Car class, so with this framework we can easily change the class to Car/MotorCycle or whatever class and just configure this spring file to the Application Context i.e., Spring Container. Spring Framework: It the light weight Dependency Injection and Aspect oriented Container and framework. As a container Spring helps in creating the objects and managing the wiring b/w the objects and also the life cycle of the object. The basic concept of the Inversion of Control pattern (also known as dependency injection) is that you do not create your objects but describe how they should be created. You don't directly connect your components and services together in code but describe which services are needed by which components in a configuration file. A container (in the case of the Spring framework, the IOC container) is then responsible for hooking it all up. i.e., Applying IoC, objects are given their dependencies at creation time by some external entity that coordinates each object in the system. That is, dependencies are injected into objects. So, IoC means an inversion of responsibility with regard to how an object obtains references to collaborating objects. What are the different types of IOC (dependency injection) ? There are three types of dependency injection: Constructor Injection (e.g. Pico container, Spring etc): Dependencies are provided as constructor parameters. Setter Injection (e.g. Spring): Dependencies are assigned through JavaBeans properties (ex: setter methods). Interface Injection (e.g. Avalon): Injection is done through an interface. Note: Spring supports only Constructor and Setter Injection Spring framework overview at very high level [/quote] good try ilagee nerchuko interview lo baga cheppachu Link to comment Share on other sites More sharing options...
chinni005 Posted June 19, 2013 Report Share Posted June 19, 2013 [quote name='HAPPYNESS' timestamp='1371678838' post='1303871804'] Different stages of a thread New Runnable Blocked Waiting Time-Waiting Terminated NEW A thread that has not yet started is in this state. RUNNABLE A thread executing in the Java virtual machine is in this state. BLOCKED A thread that is blocked waiting for a monitor lock is in this state. WAITING A thread that is waiting indefinitely for another thread to perform a particular action is in this state. TIMED_WAITING A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state. TERMINATED A thread that has exited is in this state. [/quote] vendor question Link to comment Share on other sites More sharing options...
chinni005 Posted June 19, 2013 Report Share Posted June 19, 2013 [quote name='HAPPYNESS' timestamp='1371678421' post='1303871760'] endi raa idi..equals() , == use chesi cheppu clear ga... FOO endi ra inkem dorakaleda ...[color=#ff0000][size=6]neenu asale 1 line code raste 10 error lu vastaiii[/size][/color] [/quote] [size=4] [/size] Link to comment Share on other sites More sharing options...
chinni005 Posted June 19, 2013 Report Share Posted June 19, 2013 [quote name='HAPPYNESS' timestamp='1371681029' post='1303871891'] good try ilagee nerchuko interview lo baga cheppachu [/quote] [size=4] [/size] Link to comment Share on other sites More sharing options...
ZuniorVentiyar Posted June 19, 2013 Report Share Posted June 19, 2013 ok happy vacle .... ippudu string anee class undi java lo .... adi immutable chesaru java lo ( all Wrapper classes like Integer, Double etc are immutable not only String) .... immutable anteee String class ni final gaa declare chesi dobaru .... but why ????? endhuku antee nobody can extend String class and override the String class implmentation.... again WHY???? ... next part lo chudam ala endhuku chesarooo [quote name='HAPPYNESS' timestamp='1371680383' post='1303871863'] okka mukka kuda ardam kaala...append entiii ee gola entiii naaku clear ga cheppu mayyaa [/quote] Link to comment Share on other sites More sharing options...
cherlapalli_jailer Posted June 19, 2013 Report Share Posted June 19, 2013 String class is immutable StringBuffer Mutable this especially impacts when we construct string on the fly ex String str = new String() ; for(int i = 0;i<10;i++){ str = str + "next number"+i ; } instead best practice is StringBuffer sb = new StringBuffer() ; for(int i = 0;i<10;i++){ sb.append( "next number"+i) ; } str = sb.toString() ; Link to comment Share on other sites More sharing options...
king420 Posted June 19, 2013 Report Share Posted June 19, 2013 [quote name='Chinni_' timestamp='1371681355' post='1303871908'] [/quote] naaku variables define cheyyadam kuda radu ...bandaaalu programmer neenu ... Class ki Method ki difference teledu...rendu Public tho start avtaii ani ....edi ento telisedi kadu Link to comment Share on other sites More sharing options...
king420 Posted June 19, 2013 Report Share Posted June 19, 2013 [quote name='Java01' timestamp='1371681436' post='1303871913'] ok happy vacle .... ippudu string anee class undi java lo .... adi immutable chesaru java lo ( all Wrapper classes like Integer, Double etc are immutable not only String) .... immutable anteee String class ni final gaa declare chesi dobaru .... but why ????? endhuku antee nobody can extend String class and override the String class implmentation.... again WHY???? ... next part lo chudam ala endhuku chesarooo [/quote] oho mari Auto Boxing Auto-UnBoxing deni kindaki vastaii??? type-wrapper to Primitive Data Type....ee bashaaa endi saaami asalu Link to comment Share on other sites More sharing options...
king420 Posted June 19, 2013 Report Share Posted June 19, 2013 [quote name='cherlapalli_jailer' timestamp='1371681462' post='1303871914'] String class is immutable StringBuffer Mutable this especially impacts when we construct string on the fly ex String str = new String() ; for(int i = 0;i<10;i++){ str = str + "next number"+i ; } instead best practice is StringBuffer sb = new StringBuffer() ; for(int i = 0;i<10;i++){ sb.append( "next number"+i) ; } str = sb.toString() ; [/quote] String Buffer memory and performance wise better antav Link to comment Share on other sites More sharing options...
cherlapalli_jailer Posted June 19, 2013 Report Share Posted June 19, 2013 [quote name='HAPPYNESS' timestamp='1371681699' post='1303871921'] String Buffer memory and performance wise better antav [/quote] yep theory ante inka cggeppedamundi google lo sollu cheppatame....pratical ga idi Link to comment Share on other sites More sharing options...
ZuniorVentiyar Posted June 19, 2013 Report Share Posted June 19, 2013 int X = 10; Integer in = new Integer(); in = X; and X = in; this is autoboxing......automatically casting wrapper to premitives vice versa called autoboxing [quote name='HAPPYNESS' timestamp='1371681579' post='1303871919'] oho mari Auto Boxing Auto-UnBoxing deni kindaki vastaii??? type-wrapper to Primitive Data Type....ee bashaaa endi saaami asalu [/quote] Link to comment Share on other sites More sharing options...
cherlapalli_jailer Posted June 19, 2013 Report Share Posted June 19, 2013 Happy see if this post is useful it has all interview Q n A [quote name='innovative' timestamp='1370650472' post='1303835542'] [url="https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0CEYQFjAD&url=https%3A%2F%2Fvjv.googlecode.com%2Ffiles%2F978-1-4116-6824-9-preview.pdf&ei=CXSyUdGzOYLzygGAr4GYBQ&usg=AFQjCNHQtBcXt8Zr5iCetiP-WTaZ7svJWQ&sig2=nhvBn-U6MGJcI1UgpnWjNg&bvm=bv.47534661,d.aWM"]link 1[/url] [url="http://ismails.files.wordpress.com/2007/07/hibernate-interview-questions.pdf"][b]hibernate [/b][/url] [b][url="http://java.garnaik.com/pdf/java_garnaik_hibernate_advance_interview_questions.pdf"]hibernate[/url] - [color=#ff0000]code snippets tho explainatins vuntay .. good one [/color][/b] [url="http://www.careervarsity.com/download/jsp.doc"][b]JSP[/b][/url] - [color=#ff0000][b]direct download[/b][/color] [color=#ff0000][b]from bookmarks - for a quick review of concepts before interview : [/b][/color] credit to saggammahesh @ javaken [color=#000000][font=verdana, geneva, lucida,][url="http://www.downloadmela.com/interview-paper-download?id=47"]jdbc Interview Questions and Answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=48"]Jsp Interview Questions and Answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=49"]EJB 3.0 Interview Questions and Answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=50"]corejava Interview Questions and Answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=51"]Servlet Interview Questions and Answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=52"]JMS Interview Questions and Answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=53"]J2ME Interview Questions and Answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=706"]CVS interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=708"]JMX interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=815"]AWT interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=890"]Core Java interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=891"]Eclipse interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=892"]Hibernate interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=893"]IBM WebSphere interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=894"]J2ME interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=895"]J2SE interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=896"]Java Applet interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=897"]Java Beans interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=898"]Java EJB Programming interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=899"]Java Enterprise Edition(J2EE) interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=900"]Java JSP Programming interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=901"]Java Message Service(JMS) interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=902"]Java Networking - Sockets And RMI interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=903"]Java Patterns interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=904"]Java Security interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=905"]Java Servlet Programming interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=906"]Java Swing Programming interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=907"]Java Threads interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=908"]Java interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=909"]JBoss interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=910"]JDBC interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=911"]JMS interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=912"]JSF interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=913"]RMI interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=914"]Spring Framework interview questions and answers[/url] [url="http://www.downloadmela.com/interview-paper-download?id=915"]Struts interview questions and answers[/url][/font][/color] will update [/quote] Link to comment Share on other sites More sharing options...
geeni83 Posted June 20, 2013 Report Share Posted June 20, 2013 [quote name='HAPPYNESS' timestamp='1371678996' post='1303871813'] For example, when downloading a large file (e.g., an image, an audio clip or a video clip) over the Internet, the user may not want to wait until the entire clip downloads before starting the playback. To solve this problem,multiple threads can be used—one to download the clip, and another to play it. These activities proceed concurrently. To avoid choppy playback, the threads are synchronized (that is, their actions are coordinated) so that the player thread doesn’t begin until there’s a sufficient amount of the clip in memory to keep the player thread busy. The Java Virtual Machine (JVM) creates threads to run programs and threads to perform housekeeping tasks such as garbage collection. [/quote] thanks mayya!! Link to comment Share on other sites More sharing options...
Recommended Posts