Ganesh Patekar

Bartender
+ Follow
since Jun 24, 2015
Ganesh likes ...
Eclipse IDE Hibernate jQuery MySQL Database Spring Tomcat Server
This soul began to dwell in this body named Ganesh Patekar since 31/07/1987 in Solapur, Maharashtra, India.
Being youngest child in the family had happy childhood but I was also an obstinate kid As days go by I became more amiable.
I had persuaded Bachelors of computer application( BCA, Batch 2007-10 ) from Sinhgad College of Science, Pune. I’m so greedy about learning so couldn’t stop there so persuaded Master of computer application ( MCA ) from Sinhgad Institute of Management, Pune. I used to act as emcee and compare in college events. Those were the best days of life.
I really adore to learn new things. I always eager to write a beautiful code I enjoy visiting natural places near by Pune on weekends.
I’m passionate about maintaining good physic so I do yoga, pranayama and workout regularly because I think, health is wealth.
Pune, Maharashtra, India.
Cows and Likes
Cows
Total received
27
In last 30 days
0
Total given
9
Likes
Total received
160
Received in last 30 days
19
Total given
267
Given in last 30 days
20
Forums and Threads

Recent posts by Ganesh Patekar

Randy Too wrote:Just wonder is this an e-book ? (Not paper book) ?


Jeanne Boyarsky wrote:First, a big thanks to Karl Beecher for being here to promote Bad Programming Practices 101 (e-book)

Yes, It's an ebook.
2 days ago

Arpan Ghoshal wrote:Can you tell be how can I add myself to the OCJP wall fame, I opened the page but didn't find any option to add myself.

It appears you haven't added your name in OCAJP as well.

There is an Edit option  which lets you edit that Wiki page. Add your detail in that column the way others added. Just copy same way and put your information in appropriate columns. It's ordered by date. Recent one come on the top. We have another separate Wiki page for OCPJP too.
Congratulations,    those are really good scores.    Thank you for such detailed information. It'll definitely be helpful to others.  Don't forget to add your name to the Ocajp Wall Of Fame and OCPJP Wall Of Fame.
Topic Icons
  • Table incorporates topic icons with their respective meanings which will help to understand the current status of topic.

  • IconMeaning
    Topic with unread post(s)
    Topic with read post(s)
    Hot topic with unread post(s)
    Hot topic with read post(s)
    Requested topic with unread post(s) to be marked as resolved
    Requested topic with read post(s) to be marked as resolved
    Resolved topic with unread post(s)
    Resolved topic with read post(s)
    Unresolvable topic with unread post(s)
    Unresolvable topic with read post(s)
    Locked topic with unread post(s)
    Locked topic with read post(s)
    !Flagged topic for more attention
    Topic moved to appropriate forum Or merged with other topic by a moderator
    Unread Wiki page
    Read Wiki page
    News topic with unread post(s)
    News topic with read post(s)
    Last reply on the topic

    Note:
  • Topic marked as hot topic when it gets 20 or more replies
  • To flag a topic, enter number of flags and click Add flag(s) button at the bottom of topic page.
  • To request your created topic as resolved, click on Resolved button at the top of topic page. Resolved button will be invisible once you click on it
  • 2 days ago
    Why are you returning null when elements of a and b are same, here on line 43-45

    Suppose you have elements of a and b as follow
    Indexabcounter1counter2
    ---00
    01100
    11010
    25220

    in above scenario your counter1 should be 2 and counter2 should be 0 but in your code when elements of a and b are same instead of doing nothing you are returning null value to the place where this compareTriplets method was invoked from i.e on line 80
    which assigns null value to result variable.
    2 days ago
    Congratulations, that's really a good score   best of luck for the next exam. 
    TreeSet on line 8 being considered as class which you have defined in this Java file but not the imported java.util.TreeSet which you actually want to use. Change the name of class you created to something else.
    2 days ago

    Gary Moffat wrote:I am a professional planner, I have spent over 40 years planning things and watching them get done. I just love work, I have been watching it for many decades.

    That's an interesting as well as inspiring. 40 years of experience that is huge. We too have members over here who have such large experience. Feels good to share thoughts with experienced people.

    Once upon a time I thought I would retire and build a farmstead like the  folks over in "Permies" but I am not ready to retire, I can't afford to. I am writing this because I am somewhat frustrated, to work means to travel: I can hardly plant a garden, build a house or a piece of furniture, not even raise animals.

    Not necessarily It has to be the same think people do over in "Permies", occasionally you can go to child orphanage Or go to near by garden spend some time with people of your age ( Or of any age), make some friends there who aren't of your field so you people will not discuss same think you do when you are on work. Good to meet and have chat with other field's people. That's what I do too when I get frustrated and bored.

    If you could fix something that is wrong with the world, or even address a particular problem, what would it be?

    Honestly I don't believe there something wrong with the world. It's as It was and It will be in future too. I can fix If something I feel is wrong with myself ( of my past ) and I need to change I will try my best to change my self but I can't change others, don't even try to change other Or please anyone. I could be wrong but that's what I think.

    but Hollywood has a sort of interesting one that made money before so they have to remake it 3 or 4 times. This is the 21st century, we do not need them any more.

    Same goes with Bollywood industry always imaginary Love stories. Nothing wrong with them. They make movies on the subject we as public demands. If we stop watching flicks on a particular subject then why would they make Or make sequel of it. They are there to make money ergo will make what is in trending Or demand.

    I would rather say we better change our self ( as a person ) eventually world will change.
    3 days ago
    This is an example how you can use constructor to initialize those fields and override public String toString() method of Object class to return and print a string that "textually represents" this object i.e. an object of Test class.

    Output:
    Test code: 101 Test Name: Primary
    Test code: 102 Test Name: Secondary

    Go through The Java™ Tutorials: Providing Constructors for Your Classes to know more about constructors.
    3 days ago
    Nitpicking:
  • Method name starts with a small letter followed by camel case hence setter method setatmPin(...) would be better setAtmPin(...). Worth reading Naming Conventions
  • Variable name though It's a method parameter name better have meaningful name, here you have parameter named a in method public void setatmPin(int a), could be something else like pin Or atmPin.

  • while setting value in setter method like above It's good habit to use this keyword which refers to the current object who invoked this method. When you have method as In above method we might think we assigned value to the field atmPin of object who invoked this method which is declared at class level but in reality we have assigned passed value again to the same parameter atmPin which hides field atmPin. To avoid such mistakes you can use this keyword.

  • I'm not convinced why there is an instance variable for ATM balance i.e. private int atmBalance; since It better be shared among all objects of ATM we create.

  • Suppose we have an ATM whose balance is 10000 at the beginning.
    This is what I would expect
    1. ATM object referred by one ( User one ) withdraws 2000 then ATM balance should be 10000 - 2000 = 8000
    2. ATM object referred by two ( User two ) withdraws 3000 then ATM balance should be 8000 - 3000 = 5000
    3. ATM object referred by three ( User three ) withdraws 500 then ATM balance should be 5000 - 500 = 4500

    don't you think so?
    3 days ago

    Manish Pamnani wrote:

    We know field userName of object referred by one is set to "Manish" so prints Manish but you haven't set any values to other fields of object referred by one hence If you try to print any other fields of this object by invoking getter method on reference variable one like both prints 0 since we haven't set any values to these variables so they have default value 0 because atmBalance and atmPin are of int type.

    Each object have their own fields so you have to set them by invoking appropriate setter methods, to get values invoke getter methods and other method too like miniStatement and cash too on every object you create.

    As Carey Brown suggested It's good to use constructor to initialize these fields and use toString method to print output.

    If you haven't understood yet please go through The Java™ Tutorials: What Is an Object and What Is a Class? 

    3 days ago

    Manish Pamnani wrote:if I want to create new users then everytime I have to call the method miniStatement with a new object?

    Not only method miniStatement() but also all other setter and getter methods too. When you create a new object which will have It's own separate fields like userName, userBalance etc. you have to assign values to these fields by invoking methods like setuserName(" userName"), setatmPin(...) etc  on each object referred by one, two and three reference variables.
    If you don't assign values to these fields of each objects referred by one, two and three then they will have their default values in Java like int = 0 and String will be Null


    In your last post your code looks like this in pictorial form, see If you can understand this by an illustration.
    3 days ago
  • Local variables can't have same name. In method compareTriplets you have counter1, counter2 named variables of type int as well as List<Integer> which gives compile time error.
  • Always post complete compiler error message ( In text only, no images Or videos ) if code doesn't compile. If runs successfully and not expected output then post the current output as well as the output you are expecting.
  • You don't need to put hard coded index value to access element of List<Integer> a and List<Integer> b like you did in your code.
  • You have for loop ranging index values of j from 0-2 so use j variable as an Index like
  • You can use method of Arrays class i.e. Arrays.asList() to return an array as List in method compareTriplets.
  • You don't need to create another two variables of List<Integer> type as in your case you tried to create List<Integer> counter1 and counter2.
  • 4 days ago