This week's book giveaways are in the Angular and TypeScript and Web Services forums.
We're giving away four copies each of Programming with Types and The Design of Web APIs and have the authors on-line!
See this thread and this one for details.
Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!

Namith Kumar

Greenhorn
+ Follow
since May 20, 2009
Namith likes ...
Eclipse IDE Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
29
Given in last 30 days
8
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Namith Kumar

Great. Thank you Jeanne. I'll do that.

Jeanne Boyarsky wrote:Namith,
When I was in college, I used paper flashcards. More recently, I used Anki.

What I do is note what I think I'll need to memorize and put just that in Anki. I don't find myself needing to memorize things like "how to write a loop" because that's something I'm going to practice and learn from code. Whereas I do have to memorize things like class names. In other words, just make flashcards for the stuff you have trouble memorizing.

Hi Jeanne, I have been following your recommendations and the prep is going great so far. I have a question about preparing flash cards. How do you go about doing it ? Say for example you are in the middle of preparing and today you read about Loops . Do you buffer in some time at the end of your reading to prepare flash cards on stuff you just completed reading ? Or is this something you do at some logical points and dedicate separate time for it  ? And do you just create manual flash cards or use some software like Anki ? How much details do you put in the flash card ? And how do you go about reviewing them ?

I started creating flash cards on anki , but it seems to be getting too detailed and i dont want to end up putting the entire book in flash cards . There has got to be a better way.

Jeanne Boyarsky wrote:Namith,
I use three strategies personally:

  • Register for the test. Nothing like a due date. (You can change the date until 48 hours before. But having the date ads a sense of priority
  • Outline what I want to do before I take the exam. Add dates. I also include about 25% of buffer at the end. That let's me run late and still finish. But it also tricks me into thinking I'm behind so I don't get too far behind.
  • I read once (I think in K&B's book) to study for 15 mintues every day even if you don't feel like it. This ensures you don't lose momentum. And sometimes by the time you are 15 minutes in, you have enough flow to keep going. I keep to this. Even if it is just flashcards or reading on the train


  • Don't miss a few weeks of study. Seriously, you'll forget everything. Even if it isn't a lot of time, keep on it. It will keep the info in your head.

    Thank you Junilu. Also i see you used the ternary operator in your solution which makes it very neat. I did not think of that.

    Junilu Lacar wrote:I don't know if I'd put a limit to the length of the input string. If it's 4 characters or less, you can just return it without doing anything.

    1 week ago
    Write a method that takes a String and returns a String of the same length containing the 'X' character in all positions except the last 4 positions. The characters in the last 4 positions must be the same as in the original string. For example, if the argument is "12345678", the return value should be "XXXX5678".

    This is from Deshmukh, Hanumant. OCP Oracle Certified Professional Java SE 11 Programmer I Exam Fundamentals 1Z0-815 book

    Here is my stab at it and it works. How would you approach it ? Remember - I can only use strings.


    1 week ago
    In your code, the string duplicates starts out as a blank right ? With those 2 FOR loops , you are basically trying to take each char from your input string and compare it to the remaining chars in the string to see if there are duplicates. When you find a match , you are trying to append that char to the string duplicates.

    But before appending that char to the string duplicates , you want to make sure you are not adding a char that was already added prior (could happen when your input string is aaaaa bbbbbb) . That is what that IF statement is checking . It is making sure that the string duplicate does not already contain the char str.charAt(j) prior to appending.

    The contains method of string will return true if str.charAt(j) is already part of duplicates.

    Sibi Varghese wrote:This code is to print duplicate character of a given String.
    What does the logic behind these lines of code. Why there are two 'if' statements :                                

    if (!duplicates.contains(String.valueOf(str.charAt(j)))) {
                               duplicates += str.charAt(j);
    Can someone please explain lines 18 and 19?    

    1 week ago
    I think the mistake i made was assuming that since i did not use any "new" in my code to create a new string object, it would look for stuff in the string pool and use that if available. So that's where looking at that code helped . When i saw that internally it ended up ultimately creating a new string , i understand why the == would return false.
    Thank you for your explanation Mikalai Zaikin and Campbell Ritchie. Makes sense now . I should start getting into the habit of checking API references and Source code .
    String s1 = "abc";
    String s2 = " abc".stripLeading();

    System.out.println(s1);
    System.out.println(s2);

    System.out.println(s1 == s2);


    This prints out

    abc
    abc
    false


    I was expecting that when it strips leading , its going to return the same string as s1 since that is already in the pool. Why did the last statement return false ?
    Thank you so much Jeanne  & Scott. Thank you Code Ranch team!

    I am beyond words ! This is the first time i have won anything like this . Jeanne, thanks for the great study tips you provided in response to my question. I am looking forward to my copy and can't wait to get started

    Thank you so much Jeanne. Great advice ! I really liked all of these strategies. Especially the one about studying at least 15 minutes even if you don't feel like it. My problem is exactly that - I start with high hopes and stay consistent for few weeks , but then end up missing few weeks because other things comes up and i find myself with no energy for any study at the end of the work day. Then i get back to study a few days later and as you said, everything is forgotten and i am back to the first page trying to relearn things i have learned.

    I'll start with registering for the test and work on a study plan. And most important - target at least 15 minutes of study even if i don't feel like it. Thanks again.



    Hello Jeanne and Scott,

    Congratulations on your new book ! As you know, Preparing for a certification is no easy task. Takes months of consistent practice. Even if you start with a plan , reality is that unexpected things come up and sometimes , weeks could go by without being able to prepare. What are some of the strategies you use to stay focused and consistent ? How do you get back when things don't go as planned and you missed a few weeks of study ?
    Thank you, Mr. Deshmukh. I had not reached till that point , yet. Will take a look at your book. Appreciate your response.
    Hello Mr Deshmukh,

    I am midway through preparing for OCJA exam with Java 8 when i saw this book release email. Do you recommend i do the Java 11 exam instead ?  or should i just finish OCJA and then maybe plan an upgrade .

    Many Thanks.
    Thanks Jean. Now i get it . Since reference variable deer is defined as type Deer (parent class) and the hasHorns method in Deer is declared as private , at compile time , this will get resolved to the hasHorns method of the parent Deer class. There will no chance of overriding since the method is declared private . It looks like JVM does not bother to check the run time reference if a similarly named method is present.