Posted by: lrrp | June 29, 2015

Understanding HelloWorld in Java

When I first started with Java programming, the fist program I wrote was HelloWorld in Java. That time I just copied it from a text book we were referring, I didn’t know anything about it. It took me a lot of time to understand everything about Helloworld in Java and how it works. From that time, I made it a rule to start with writing Helloworld program in any new programming language I learn and try to understand every single element of it in as much detail as possible, but,  to be frank its not that easy.

When you write say Helloworld in Java,  you are not capable enough to understand everything about it, and I found it better that instead of learning everything in one go, you should give yourself some time to let the knowledge you learned sink in. It’s even better if you write Helloworld program multiple times without looking at  the book. I have found that doing it repeatedly helps you to understand it better.

 * Helloworld in Java, your first Java Program
 * @author Javin Paul
public class HelloWorld {

    public static void main(String args[]) {       
       System.out.println("Helloworld in Java");


I am using Eclipse to write it again but I suggest you guys to use notepad and command prompt because that’s where you understand How PATH and CLASSPATH works in Java. So, if you are writing it in notepad then make sure you follow below steps :

1) Save your HelloWorld program into a file also name as, name of your public class should exactly match with the name of file.

2) First compile your file to create class file, for that just go to the directory where you have saved your file and execute following command :

$ javac

If you get error “javac is not recognized as an internal or external command” it means your PATH is not set properly and system is not able to look for “javac” command it need to compiler Java file. Its usually due to missing JDK bin directory in PATH and I suggest you to read that article to sort it

3) If you able to compile the Java source file then you will see a class file “HelloWorld.class” file in same directory. It means half job is done, now you just need to run it. In order to run a Java program, you need to use “java” command as shown below :

$ java HelloWorld

Remember there is no extension, its just the name of your public class which contains main method. If everything goes well then you will see message “HelloWorld in Java” in your screen or console. If you get error “Could not find or load main class” then you need to check out that article to find the exact reason. This usually happens when you use package to store your class but in this article, I have not used package so you will very unlikely to get that error.

Posted by: lrrp | June 29, 2015

What happens When System.out.println(null)?

    • Compilation Error -This is because you can pass an Object or a String or char[]. Since null can fit in both, the compiler doesn’t know which method to use, leading to compile error.
  • Method Overloading:
    1.public void prinltln(String str) { }
    2.public void prinltln(char[] ch){ }
    3.public void prinltln(Object ch){
  •  It seems the call System.out.print(null) is ambiguous to compiler because print(null) here will find the two best specific matches i.e. print(String) and print(char[]) . So compiler is unable to determine which method to call here .
  • Compilation Error:
  • Compile Fine:
  • It’s the compiler type-checking the parameters of the method call.
  • But here we need to know one more thing  System.out.println((char[])null); will compile fine but at run time will throw runtime exception.
Posted by: lrrp | June 29, 2015

5 Great Snacks For the Coder’s Brain

You’re coding and you’ve been in the flow for a few hours. Everything is going just fine, but then hunger strikes suddenly. Since you don’t have anything on hand, you go to the cafeteria or to a nearby café to grab a muffin or a pastry full of sugar. When you sit down to resume coding while eating your snack, you feel good for a few minutes, but the sugar spike soon wears off. You start feeling like crap, and your productivity screeches to a halt. Sounds familiar?

This happens to everybody from time to time. Working with your brain makes you hungry very fast, but eating a large sugary snack to compensate and topping it with an energy drink is the least productive way to go about it. If you’re well prepared and have good quality snacks on hand, you won’t feel like crap after eating and you will be able to resume coding in no time. Great snacks are also power foods that are great for your health, so it’s worth adding them in your diet.

So here are a few snacks you should try:

  • Nuts and seeds: this is one of the best power snack to keep around since they store well and you don’t need to eat a lot to feel better. You should be making your own mixes if you can, since most trail mixes available on the market are too salty, too sugary or both. You can add all your favourite nuts, but almond, walnut, Brazil nuts, pumpkin seeds and sunflower seeds are all great choices. You can add a bit of quality dark chocolate or dried fruits to the mix for more variety.
  • Fresh fruits: All fruits are also good snacks. You can bring along anything from bananas and apples, but for pure nutritional values berries are the best. I don’t recommend fruits like kiwi that need to be peeled since you don’t want to mess around when you want something quick. Fruits can also be kept at your desk for a few days if you want to bring some in advance.
  • Yoghurt or kefir: Yoghurt is a great source of protein and probiotics, but you should choose yoghurt with as little sugar as possible: you can add your own fruits if it’s too bland for you. I’ve started drinking kefir recently, which is a fermented milk drink with even more good bacterial than yoghurt. It’s interesting but it’s an acquired taste, being a lot sourer than yoghurt.
  • Egg, fish or avocado: Those require a bit more preparation, but the proteins and good fats that make it worth it. Boiled eggs takes only a few minutes for a week’s supply and are easy to eat. Avocados are also fast to prepare: just cut them in two, add some mustard or lime juice and pack them in your lunch. Half an avocado is enough for a snack, and it can easily be eaten with a spoon. And you can bring canned sardines or smoked salmon, which requires no preparation.
  • Vegetable sticks: All raw vegetables that can be cut into sticks like carrots, celery and peppers are good options. If you don’t have time to cut vegetables, you can buy bags of precut vegetables at the grocery store. Pair them with some hummus dip for added protein and you’ll have a great snack on hand. This is a good way to add more vegetables to your diet, we could all do with more of them.

As an aside, if you really like muffins and can’t do without, you can make your own whole grain muffins and use less sugar. Home made muffins will give you less of a crash than white flour and allow you to add more fruits, nuts and seeds. You can also make smaller portion when you bake them yourself, since most store-brought muffins are huge. This is a bit heavier than the other snack options, taking more energy to digest. Many people have trouble when they eat too much grains or gluten, so you should try it and see what works for you.

Which snack are you going to try? Do you have a favourite snack that’s not on the list? I’m always on the lookout for new ideas, so please share your routine!

Being able to quickly and efficiently one-line our skills and the focus of our professional life has a lot of value. The title that we use can effectively tell others what we do, and where our career is heading. Despite this importance, titles are something many of us have trouble with.

“designers who understand code, produce more realistic mockups”

It’s definitely hard to find a title that clearly explains our skills and limitations as a professional. Understanding the full-stack terminology isn’t only beneficial to help give ourselves a title though. It’s also immensely valuable to become that team member who can step in at any phase of a project to help out. Or just to use the skills in planning ahead of what our main job focus may be (It’s common knowledge that designers who understand code, produce more realistic mockups). So, how do we get started?

What is a full-stack designer?

In the “old” days, it was fairly straightforward. There was very clear separation between the design and development groups, with very few people doing both. Now though, it’s fairly uncommon to find a web designer that doesn’t also do some sort of development or UX work as well. With many of us branching into more skills within our industry, we’re becoming increasingly more resourceful. The problem is that now a “web designer” could mean someone who only does design, does design and some code, or may even handle the full design to development process! We’ve become an industry of renaissance workers not content with learning just what we need to get by, and that’s a great thing.

“web designer” could mean someone who only does design, does design and some code, or may even handle the full design to development process”

Enter the full-stack designer. Being full-stack simply refers to someone who is cross-disciplinary and able to take a project through to completion. In this case, it’s referring to an individual who has the skills to carry a project through the first few major project phases. Full-stack developers have been around for years now, handling everything from front-end dev, back-end dev, back-end server management, and more.

I know what you’re thinking: “Great, another marketing phrase is just what this industry needs!” But I can assure you this one is sticking around, and it has more value than a hip moniker. Take a look at a large selection of job openings and you’ll undoubtedly find many “Product Designer” and “Full-Stack Designer” listings.

Fringe benefits of being full-stack

The benefits of expanding our skill sets are quite nice. Full-stack designers often end up with a more thorough understanding of their work, making it more consistent from research to production phases. Knowing the limitations and what to expect in development, while planning UX/UI wireframes, can keep concepts realistic. So not only are full-stack designers more knowledgeable about what can and cannot work elegantly in design, but they also have more realistic expectations before we even start pushing pixels or coding.

Having an expansive skill set is exceedingly beneficial to the people who employ us as well! Our employers are afforded a team member who can jump in and help even outside their area of focus. This means keeping teams lean and diversified with less people, and everyone having more of a grasp of the whole-picture.

There are countless good qualities about having such an expansive skill set, but the most important being you just learn more. Even having a basic foundation in development or another skill can increase the likelihood of learning more in that area. With that small nugget of knowledge already in place, pursuing further education is made easier as the content is already slightly more relatable. So next time you see that article about the skill you’ve been meaning to learn for ages, just go for it. You don’t have to be an expert by the end of it, you just have to remember enough to make next time easier.

The pitfalls of expansive skill sets

It’s taken us quite a while to even get where we are today in terms of education. Being able to instantly look something up and “accidentally” spend the next four hours learning about it is the fantastic future we live in. But, when you have dozens of technologies, practices, and skills to keep up to date, that process can easily result in a long “to-read” list. With so much to keep up with, it’s easy to simply not have enough time. That doesn’t mean we lose lose the skill altogether, it merely means that skill isn’t one of our highlights, so to speak. It’s very common that someone could be an expert with CSS/HTML, yet only have a basic working knowledge of JavaScript.

It’s not only hard to keep up with everything, but it’s also hard to pinpoint which technologies to invest our time with as well. With the industry growing at such a fast rate, there’s a new language, library, and use pattern by the end of each day. Anyone remember the days of jQuery vs MooTools vs JavaScript debates? Pinpointing which skills to learn, and which are merely passing fads can easily make or break a time investment.

Employers aren’t exempt from these pitfalls either. Being a much more skilled team member typically comes along with a higher salary. While most full-stack designers won’t cost the same as multiple designers and developers, they certainly cost a premium to be just as skillful.

Why are full-stack designers important?

Becoming a full-stack anything is special in and of itself. It’s investing quite a lot of time and effort into oneself professionally, most often outside the workplace. So what makes full-stack designers so important? Primarily, it’s the skills in their spectrum. Typically, designers are the ones organizing research, creating wireframes, checking out UX patterns, organizing UI design, and generally making sure we aren’t ending up with stunningly beautiful websites and apps that simply don’t have a purpose.

“Being more than just a cog in the machine is what being full-stack is all about”

Being more than just a cog in the machine is what being full-stack is all about. When it comes to design, that means defining what a project’s purpose and goals are in the planning phases while also keeping design and development limitations and goals in mind. Someone who can thoroughly manage and understand a project from its conception all the way to its first steps into development makes for a much more consistent experience. Some of the best websites, apps, and even products you’ve used were likely created or overseen by a manager with such a vast skill set to ensure such high quality.

The making of a renaissance worker

Expanding our skills and knowledge to become full-stack can be invaluable on a team, and an absolute necessity as a lone freelancer. With quality education becoming exceptionally easy to find, it’s become an enjoyable experience to learn more these days. The hard part it seems, comes with understanding which skills we should learn. Each person’s skill set is unique, and that’s what makes everyone uniquely valuable.

A few years ago, for example, having a hobbyist’s interest in social media almost instantly became an exceptionally valuable asset when the social media boom took off. Companies and agencies were looking left and right for people to help them manage their presence on such platforms. So how do we maximize our value by choosing the right skills?

The best way to pursue education is to always ask yourself what would make you more valuable at what you already do. For most designers, that means learning to code or pursuing a deeper understanding of the science and psychology behind UX design. But for other designers, the answer may mean focusing on print and branding design. It’s really hard to say which particular languages, assets, and skills are critical to have, especially in an industry as fast paced and diverse as ours. If you’re still stumped, take a look at job openings in positions you would enjoy filling. See what they’re requiring and, more importantly hoping for, in a candidate.


Titles are important, there’s no doubt about it. But only because they represent (albeit, poorly) the skills we possess. When it comes down to it, investing the time to further ourselves professionally by expanding those skills only benefits everyone involved. Continued education has always been a part of our fast paced industry, so let’s use that to our advantage and become the best full-stack workers out there.

This article provides some time tested solutions to improve your coding skills. Success is not a product of chance. It is the sum result of all the choices that you will make. The eye-opening tips will transform you into a happy programmer : )

Tip # 1: Make you plan before you start coding.

You can never be too prepared. In this stage, you want to make sure that you understand all the requirements of the users. You also need to ensure that you understand or anticipate future requirements. Come up with a plan that solves the present and can accommodate future requirements with ease. Read this article How to Plan a Coding Project for more details

Tip # 2: Use Version Control Software

“The Only Thing That Is Constant Is Change -”. ― Heraclitus. Bugs are always fixed in software, new features are added and old ones removed. New versions are developed and old code needs to be maintained too. Never say the cat ate my code 1 year down the line after you shipped version one of the killer ERP software and the client wants new features. Read these free tutorial series on Software Version Control with Git for more details

Tip # 3: Use descriptive names for variables and functions

Avoid using abbreviates especially weird ones such as x or y as a variable name that holds data used for computations in a tax program. Make your variables and method names part of the documentation. A descriptive name will tell you what the variable is and what the method is supposed to do.

Tip # 4: Don’t repeat yourself. Write once use many times

Oh yes, the DRY principle. Don’t repeat yourself. Let’s say you have a project that display data to the user in different windows. The displayed data needs to be formatted in a certain way. Instead of copying and pasting the code formatting the data in all the windows, you can create a function that you can call from all those windows that need to format data. This way, you write the function once and use it many times.

Tip # 5: Comment your code

The best kind of comments are the ones you don’t need. Comments should tell you why and not how. There is little value in commenting //this method connects to the database when the method name already says connectToDB. For more details, read this article Code tells you how, comments tell you why?

Tip # 6: Share your knowledge with others

Almost always, there is someone who knows more than you do. Sharing your solution does not only help others. It gives you an opportunity for a review and if someone sees a weakness in your implementation, they will highlight that. If this doesn’t make you better than I don’t know what does.

Tip # 7: Work on a single project at a time

Focusing on a single project at a time has been proven to be more productive than working on multiple projects. Let’s assume you take 10 seconds to finish tasks A and B. let’s say you spend a second on each project then switch to the other. The time it takes you to complete both projects when multi-tasking will be roughly 30 seconds. The other 9 is for switching between projects. If you concentrate on a single project and finish it before you move to the next one then you spent 21 seconds. Read this article by Joel Spolsky Human Task Switches Considered Harmful for more details

Take action now

Kode Blog is dedicated to making you a better programmer. Get free programming tips, tutorials and articles by subscribing to our bi-weekly newsletter below. We promise not to spam and you. Happy coding and sharing!

Posted by: lrrp | June 29, 2015

7 Steps to Becoming a Better Coder

  1. Code more. Code even more. Code even more than that. Code when you don’t want to. Code when you do. Code when you have to fix a problem. Code when you don’t. Code every day. Keep coding.
  2. Help other coders with their coding problems
  3. Re-code the already coded code
  4. Code for a coding contest i.e. top coder,
  5. Contribute code to an open source project
  6. Code design patterns… you know the theories behind design patterns right?
  7. Write tests for your code.


Going the whole day coding without taking a break is one of the worst decisions a colder can make. Plan your time, code for three hours and take a 30 minutes nap. Go to the gym or joking etc.Workout your algorithms on paper before doing the actual coding. Follow the above ritual over and over…

Posted by: lrrp | June 24, 2015

10 team building tips

1. Good Morning

When you enter in the office, before sitting on your desk, smile and say good morning to the team. Yes, E V E R Y day.

2. Listen when someone is talking to you.

When a team member is talking to you, look him in the eyes and show interest in what he is saying.

3. Give space, build trust

Let team member fail sometimes and repair from their failures.You may be always right, but who cares?! Other people need to learn to fail and take responsibilities.

4. Connect

Go and take a coffee with each person in the team separately.


When someone does something good, tell her/him!

6. Keep your personal problems out of work.

Don’t shout at people because your last evening was bad.

7. Do pair programming

Great way to share knowledge and build solid work relationships.

8.  Feedback

Do code reviews without sounding the king of the programming universe. Explain in a calm and friendly tone whatever you want to say.

9. Have lunch together

If possible go regularly to lunch with as many team members as possible.

10. See you tomorrow

When you leave in the evening, if you are not the last person in the team left, say goodbye.

(Marco Castigliego)

One of the common interview question is “What is difference between ArrayList and LinkedList”.Before we actually see differences,let me give you brief introduction of both.


  • ArrayList is implementation of list interface.
  • ArrayList is not synchonized(so not thread safe)
  • ArrayList is implemented using array as internal data structure.It can be dynamically resized .


  • LinkedList is implementation of list and deque interface.
  • LinkedList is not synchronized
  • LinkedList is implemented using doubly linked list as internal data structure.

ArrayList vs LinkedList:

Parameter ArrayList LinkedList
Internal data structure It uses dynamic array to store elements internally It uses doubly Linked List to store elements internally
Manipulation If We need to insert or delete element in ArrayList, it may take O(n), as it internally uses array and we may have to shift elements in case of insertion or deletion If We need to insert or delete element in LinkedList, it will take O(1), as it internally uses doubly LinkedList
Search Search is faster in ArrayList as uses array internally which is index based. So here time complexity is O(1) Search is slower in LinkedList as uses doubly Linked List internally So here time complexity is O(n)
Interfaces ArrayList implements List interface only, So it can be used as List only LinkedList implements List,Deque interfaces, so it can be used as List,Stack or Queue

When to use ArrayList or LinkedList?

It actually depends on our need.

  • If we have more insertion or deletion then we should use LinkedList.
  • If we have less insertion or deletion and more search operations then we should use ArrayList.
Posted by: lrrp | April 4, 2015

Network Administrators


Posted by: lrrp | April 4, 2015

Web Developers


« Newer Posts - Older Posts »