Java Decompiler and a surprising bug in JDK1.8

Currently at video 54, am well on my way to complete the course by this weekend.. While I was learning the class on “HashMap”, Eclipse prompted me to import the class once I declared an object in my main method.  As soon as I wrote the import, it started showing me this weird error – “Type hashmap is not visible” ( do not record the error, cannot exactly remember).  Nothing I did changed the program’s fate. Finally, with the help of my friend at work – I figured out that rt.jar in JDK1.8 is creating the problem. ArrayList and LinkedList works fine, but all Map and it’s related sub classes are not recognized.  Realizing my mistake of downloading the latest JDK version, I promptly downloaded the stable version of JDK1.7 and set JAVA_PATH and Eclipse JRE Path correctly. Viola, the error just disappeared!!

Rather strange, isn’t it?

Java Decompiler and why do we need it?

In this entire process, I learnt about Java Decompiler. It’s a plugin available for free on the Internet. Get yours here :

and follow the instructions mentioned. The main reason to install this plugin is to obtain the source code of any class in question. Ctrl+ click will reveal the Java code behind the imported class.  I heard from the same friend that, sometimes we only have the jar files with imported classes and do not have the source code. And your project demands you to change something in that class. JAD ( Java Decompiler) will come to rescue –  find the source code of the class in question, copy the code, change it and re-generate the jar 😀

Hope you learnt a thing or two by reading so far. Have a good day and keep rocking!!


Opinions and what to do with them


All through your life – you have to do something.  Study something,  learn something,  work somewhere and marry someone.  Although what I have outlined are major life decisions – everyday we make hundreds of small decisions that will not impact our life in such a grand scale but nevertheless will be a plus or minus to the current scheme of things. So, what to do with the countless decisions and innumerable opinions on them?  It’s best to remember the definition of OPINION –

a view or judgment formed about something, not necessarily based on fact or knowledge

And, it is important to re-iterate that opinions are not necessarily based on FACT or  KNOWLEDGE. By  far, from what I have observed – Opinions largely depend on the person who is making them, influenced by their life experiences and knowledge or lack of. So, how much should you value other’s opinions? 

Listen to everyone. Follow no one ~ Anonymous

Always LISTEN, with an intent to listen not to dispute or prove the other person WRONG. After listening, think through if the  Opinion makes any sense for you, or is it just something they are telling themselves aloud? Mostly, it’s the other way round. Is there something that can be better by implementing the opinion? Think Through and filter well.  At first, the entire task looks tedious but it’s a great way to subjectively analyze unscientific opinions and either accept/ reject them.

A better way to evaluate opinions is to calmly reflect or meditate upon them to understand the root cause.  My days are much better after understanding where people’s opinions come from. 


On closing note, I would like you to leave you with a single thought –

“If someone isn’t what others want them to be, the others become angry. Everyone seems to have a clear idea of how other people should lead their lives, but none about his or her own.” 
― Paulo CoelhoThe Alchemist

And another of my favorite –

“Don’t judge a man by his opinions, but what his opinions have made of him.” 
― Georg Christoph Lichtenberg


Have a good day and keep rocking!!

What’s your attitude to the problems in Life?

problemAs a wise man once said,  life is all about moving from one problem to another as long as we are alive. But, how we live is largely determined by how we approach the problem rather than the problem itself.

As my personal introspection deepens everyday, I noticed two kinds of approaches to any problem in life –  Keep giving perennial excuses or DO/ Think of a Solution or way out of the problem. Even if the solution means to leave the situation as it is, and take no action.

My husband is the wisest person I know – and one of the traits that makes him wise is the approach he takes towards things in Life.  100% of the times , his approach is DO, rather than provide EXCUSES. And that directly results in lot of positivity within and around you.  To my dismay, I noticed myself providing excuses and solutions on a random basis as responses to problems. And finally figured out that – ” If you want to do something, you WILL find ways to do it. If you do not want to do something, you WILL find ways to do it”.



A large part of providing excuses comes from habit. And these habits are formed at some point in life – which tells us we are inadequate physically, emotionally and financially.  As we tell these things over and over – the mind shrinks in capacity and never lets us try new things.  Our office staff boy, who gives me delicious tea got recently married.  He is barely educated and earns a lot less. His wife is a nurse, and he has enrolled her in Post Graduate for Nursing. Do you think he has enough money? Do you think his wife has enough time to perform daily chores, go to college and look after the family?  As long as they think – they DO. And that is what brings GOOD changes in Life.

Life is a series of habits playing one after the other TWICE – once in your head as thoughts and second to others as ACTIONS. I devised a simple experiment to catch hold of myself whenever I give an excuse, which was way more times than I imagined.  Upon further analysis, I found that all the things I was providing excuse had a common theme – I was afraid of doing them, due to some bad or lack of experiences in that area.  So, now –  I perfectly know that 99% of my fears are baseless and am not afraid to tell myself back that this is a bad habit I need to kick out.


By doing things step by step. Little by little.  I enrolled myself in Java free course on Udemy, just to get out of the habit of looking at things in a complex way. Everyday, I do 2-3 videos and am well on the way.  Now, I know how to get myself out of an excuse to try new things.

It’s okay to provide excuses, as long as you are able to justify them. Cultivate the habit of questioning your excuses along every step –  you will find them disappear in no time.

Have a good day and keep rocking!


Java : Access Modifiers – A tricky point to remember

With a mission to complete Java basic developer certification on July 5th,  I have been still not so regular with my training.  At Chapter 29 out of 72 at the Udemy course.  Chapter 29 is about Access Modifiers, and there is one thing to remember about “Protected” declaration for variables and methods.

As the usual explanation goes –

> Private –  Accessible only from within the Class

> Public – Accessible from anywhere in the world

> No Access Modifier –  Accessible within the same package

> Protected – Accessible within the same package and subclasses in other packages

The tricky part is : Subclasses in other packages.

Here is the code I wrote to refresh this concept –

// in Package “Fruit” –

package Fruit;

public class General {

private String generalname;
public String name;

protected int quantity;
int sold;

public General(String name) {

generalname = “Fruit”; = name;
System.out.println(“General constructor with name called”);

public General(int quantity, int sold)
this.quantity = quantity;
this.sold = sold;
System.out.println(“General constructor with quantity called”);


// in default package

import Fruit.General;

public class Apple extends General{

int value;

public Apple(int quantity, int sold)
super(quantity, sold);
value = 10;

public void displayInfo()
System.out.println(“Quantity = ” + quantity);
// within the same package, cannot access sold variable
//System.out.println(“Sold = ” + sold);
System.out.println(“Value = ” + value);


// in default package which contains the main method

import Fruit.General;

public class App {

public static void main(String[] args) {

General g = new General(“Saanvi”);
General g1 = new General(10,5);

Apple a = new Apple(50,5);
a.displayInfo();   // This works – as the protected members can be accessed within the subclass in a different package

system.out.println(a.quantity); // This will not work, as the variable quantity is not PUBLIC to be accessed from main method


Also, another thing to note is that the variable “sold” has no access modifier and hence has package level visibility. It is not visible within the class Apple.

A rather neat explanation is provided in this stackexchange Q & A thread. Take a look when time permits.

Happy Coding! 😀

Does our Education Teach us to Communicate well?

I was in office after couple of days, and was summoned to my CEO’s room in 5 minutes. Wondering what’s burning, I went in.  Another manager was in and the feedback was on the batch joined couple of months back.  I trained them on the domain skills and knew the batch joiners fairly well. It seems the other manager had assigned them a project last thursday, and I assigned them a domain specific practice project on Friday with deadline today.  All the team promptly( around 15 people) stopped working on the other manager’s work and were only working on mine for the whole week. 

“We cannot have people who cannot multi task. Please educate them about our culture”, said my CEO.

I called the entire batch into the room. While I can talk on tech stuff for days together, lecturing a batch of people on culture and responsibility was something new to me as well. But, as you grow in career, you need to learn stuff along the way.  Somehow, I did not believe that the team was irresponsible and want to run off at 6 PM everyday.  It must be a severe miscommunication, I thought to myself.  Spoke to every single one of them, while making them sit in the group.  More than half were waiting for some communication from the other manager regarding some module allocation. NONE of them went ahead and asked him. When I asked them- ” WHY?”, they did not have an answer.  Mind you, these are not freshers but everyone in the room has an average of 2+ years of corporate experience. So, what’s lacking?

The ability to communicate. The ability to ask questions.

Our Excellent Education system turns inquisitive kids into dumb rule obeying adults. All the batch was worried on meeting my deadline of friday – but were comfortable to stop the work and never check with the other manager.  After an hour of trying to get them to communicate,  I think i fairly succeeded a bit. They did get the message, but did not appear like kids scolded by an angry teacher.

The first things people need to be taught once they enter the workforce – Become KIDS again and ask questions to your heart’s content.  People will like you for talking, and being communicative.

Another weird incident happened last week, more on that in the next post.

Have a good day and keep rocking!!


Eclipse Error: The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files

Really Weird.  Came across this error in Chapter 24 of the Basic Java Programming Course in Udemy.  When I first used the below code, it compiled fine.  Later, I added printf as part of learning string formatting. As Eclipse started complaining, I changed the compiler settings to 1.6, and from then the StringBuilder code just doesn’t work.

So, what I figured out  – Eclipse with version 1.6 cannot support StringBuilder class and system.out.printf() simultaneously. Here is the code I used .  I first compiled and ran StringBuilder class, and then commented out to further practice printf function.

There are a bunch of solutions suggested for this –  Close & re-open project,  add JRE to build path again, Clean the Java Project and so on. Give all these a try, but if nothing works – check if 2 parts of code are incompatible  together with the compiler. You can test things by commenting one portion and running Java program again.

public class StringBuffer {
public static void main(String[] args) {

/* StringBuilder b = new StringBuilder();

System.out.println(b.toString()); */

// String Formatting

System.out.printf(“Total cost – %d, Total Quantity – %d\n”, 120,5);

for(int i = 0;i < 20; i++){
System.out.printf(“%d – %s\n”, i, “here is some text”);

// Formatting floating point values

System.out.printf(“Total value = %.2f”, 5.6897);
System.out.printf(“Total value = %-5.1f”, 56897.3446);