vijayjust4u Posted October 21, 2013 Report Share Posted October 21, 2013 [quote name='kiran karthik' timestamp='1382286414' post='1304441896'] reason? [/quote] It is called, loose coupling. Spring framework antha ee concept medhe base ayyindhi. Link to comment Share on other sites More sharing options...
chandu1987 Posted October 21, 2013 Report Share Posted October 21, 2013 [quote name='ZOO_LAKA_TAKA' timestamp='1382209296' post='1304439339'] 1 by 1 cheputhaaa ... anni oka sareee type cheseee opikaa ledhu .....lets start Q : diff between linked list and arraylist....what will you choose and in which scenario linked list and arraylist both are implementation of list interface .... anteee rendu kuda dynamically grow , orderd ( antee nuvvu etla peduthy gatlanee vosthayi ) and duplicates maintain chesthayi .... so differences enti ??? ...linkedlist is implementaion of double linked list .... anteee current elemnt nundi next element ki pointer tho reference chestharu ...... like 5th elemnt has reference to 6th element ..... arraylist is not like this .... its simply an array internally ....... when to use ???? arraylist .... if u want to store and read from group of elements .... go with arraylist antee more read operations then modifying the list ...... when u insert a element in arraylist lets say size is 200 , now u insert at 100th poistion , all elements after 100 to 200 need to adjust ........ linkedlist ...... if u have more insertion and deletions go with this ..... endhuku anteee linkedlist just mantain reference to next element ..... if u insert at 100th poision just remove the reference for 100th element and add this reference to new element and add the new element reference to 101th element .... so insertions/deletions will take less time .......... [/quote] [quote name='ZOO_LAKA_TAKA' timestamp='1382210986' post='1304439424'] kindhi question koncham tough so geedhi explain chesthaaa Q: how do you implement singleton pattern using lazy initialization? regular singleton lo manam static method and static instance pedutham kadhaaa , as per java initialization process it will initialize all static variables and static methods of a class in to memory even before constructor initialize this is eager loading ....... now there is trick here , instead of this, create a static inner class and initialize the super class instance in this static inner class ..... then add a static method in outer class return the instance here from inner class ... JVM is cleaver enough here to understand if there is any reference to inner class then only it loads this in to memory ....... public class Peddodu{ static class Chinnodu{ static Peddodu anna = new Peddodu(); } public static Peddodu getInstance() { return Chinnodu.anna; } } [/quote] Thank you for the explanation...can you suggest some good books to learn these type of concepts? Link to comment Share on other sites More sharing options...
ICANWIN Posted October 22, 2013 Report Share Posted October 22, 2013 [quote name='innovative' timestamp='1382142218' post='1304436759'] GP helpful .. But kinda tough ques adigaru .. inka ila theoretical question aduguthunnara .. scenario based vuntay kada max interviews.. no developer can say text book content ... [/quote] theory + experienced + code tests anni adugutaru...actually contracting lo elanti questions common...these days java interviews are becoming too tough...dont know why Link to comment Share on other sites More sharing options...
innovative Posted October 22, 2013 Report Share Posted October 22, 2013 [quote name='ICANWIN' timestamp='1382403692' post='1304446894'] theory + experienced + code tests anni adugutaru...actually contracting lo elanti questions common...these days java interviews are becoming too tough...dont know why [/quote] But mostly desis inteview chesthene ekkuva theory question vuntayi emo .. tellollu iythe definite ga scenario based lo test chetharu .. you know better though .. recently interviews attend ayyav kabatti .. inthaki howz it going ? Link to comment Share on other sites More sharing options...
tpt2usa123 Posted October 22, 2013 Report Share Posted October 22, 2013 Any one worked for ITPI staffing as PV, vallu H1 transfer chestara... Link to comment Share on other sites More sharing options...
kiran karthik Posted November 19, 2013 Report Share Posted November 19, 2013 In encapsulation, how are we protecting the data? cuz even if we make the instance variables as proteced or private, we can change the value of that variable using getters and setters. Link to comment Share on other sites More sharing options...
cherlapalli_jailer Posted November 19, 2013 Report Share Posted November 19, 2013 In encapsulation, how are we protecting the data? cuz even if we make the instance variables as proteced or private, we can change the value of that variable using getters and setters. static final Link to comment Share on other sites More sharing options...
kiran karthik Posted November 19, 2013 Report Share Posted November 19, 2013 static final nope, u didn't get my question Encapsulation meant for hiding the data behind the public programming interfaces(getters and setters). Even if i use getters and setters i can change the value right? so how the data would be protected? Link to comment Share on other sites More sharing options...
biscuitRAJA000 Posted November 19, 2013 Report Share Posted November 19, 2013 nope, u didn't get my question Encapsulation meant for hiding the data behind the public programming interfaces(getters and setters). Even if i use getters and setters i can change the value right? so how the data would be protected? by using private acces modifier Link to comment Share on other sites More sharing options...
chandra916 Posted November 19, 2013 Report Share Posted November 19, 2013 by using private acces modifier bhayya job vachhinda? Link to comment Share on other sites More sharing options...
biscuitRAJA000 Posted November 19, 2013 Report Share Posted November 19, 2013 bhayya job vachhinda? no $s@d CITI#H@ CITI#H@ Link to comment Share on other sites More sharing options...
cherlapalli_jailer Posted January 3, 2014 Report Share Posted January 3, 2014 ltt Link to comment Share on other sites More sharing options...
rajkiranvilla Posted January 3, 2014 Report Share Posted January 3, 2014 nope, u didn't get my question Encapsulation meant for hiding the data behind the public programming interfaces(getters and setters). Even if i use getters and setters i can change the value right? so how the data would be protected? The purpose of encapsulation is not to hide the data itself, but the implementation details on how this data is manipulated. So,you're not exactly preventing access to the fields, you're controlling how others can access certain fields. Like adding some validations on the fields lets say you have an age property.You can add some logic in the setter method to restrict such negative values. Link to comment Share on other sites More sharing options...
ICANWIN Posted January 4, 2014 Report Share Posted January 4, 2014 i have one question Lets say there is a class Class A { void doesSomething (HttpRequest req , HttpResponse res, Map<String, Object> model) { doeswhatever(req,res,model); some business logic which throws servlet exception } } Here i am over riding the method and catching the exception for flow to continue Class B extends A{ @Override void doesSomething (HttpRequest req , HttpResponse res, Map<String, Object> model) { try{ super.doeswhatever(req,res,model); }catch( ServletException ex){ logger.warn(" doing nothing here just logging the statement"); } } } Now my main task is to write test case using Junit and make the test pass for the exception block in B Void testThrowServletException () { private final HttpRequest req = null private final HttpResponse res= null private final Map<String, Object> model = mock(Map.class) ; ------------> Using Mockito new B().doeswhatever(req,res,model); Here i need to assert for the logger .warn statement in catch block for Servlet exception and pass the test New to Junit and mockito and dont know how to assert for log statement...pls help } Link to comment Share on other sites More sharing options...
ICANWIN Posted January 4, 2014 Report Share Posted January 4, 2014 below one is better programming model ..... choose always interface based programming ....List<MyClass> list = new ArrayList<MyClass>(); +1 This is where one can guage if the dev is experienced or not. Programming style is also very imp..anyone can write code but chusi cheppeyachu experienced code vs inexperience code. We use Array list now may be we might decide to go with Linked list so interface based velte code refactoring takkuva untundi...we always need to program with loose coupling and high cohesion Link to comment Share on other sites More sharing options...
Recommended Posts