Wednesday, 24 July 2013

Why should Main method in Java carry public static and void in its syntax always?

public static void main(String args[])

Every java programmer wondered to follow the syntax for main method as mentioned above. This is the reason behind the syntax. 

Why public - The access specifier of Main method is said to be public so that main method can be called outside of the class . This makes sure that JVM can easily access and execute the main method.

Why static - Main method is declared static so that JVM can call the main method with out creating instance for it. [While JVM tries to execute java program, it does not know how to create instance as there is no standard constructor defined for Main class].

Why void  - This is to make sure that Main method is not returning any values.

Cheers! Happy coding!


Thursday, 14 February 2013

Shortcut Keys - saves your time

     Most of us know that "Print Scrn" button in our keyboard will help us to take snapshots of the  screen. It will be more useful in case of developers and people who are working from different places to share their outputs, issues and bugs they are facing. But the 'Print Scrn' button will provide you with the entire screen's snap. What if we want to have the specific screen alone leaving the rest of screens behind. In windows, we can make use of 'Alt' key along with 'Print Scrn' to take screen shot of our own specific window.


Good to know :- Alt+0169 will help you to type copyright symbol. Alt+0169 ==>> ©. We have to keep on pressing 'Alt' while entering 0169 to do this. 



Thursday, 30 August 2012

Bigdecimal not exporting properly

When i was in need of generating my table's data into a report in excel format, i came across this issue.  I was using Spreadsheet gem for this purpose. The value of a particular cell contained lot of decimal places when i wanted it to be only 2 decimal place. After a lot of search, i found a good solution from rubyspreadsheet forum.


 amount = BigDecimal.new(".510283891298392")  
 sheet[0,4]= ("%7.2f" %amount).to_f         /*Converts the Big decimal to a value with 2 Floating points and write it to the (0,4)th cell */ 


If you want to know more, visit this link.

Friday, 24 August 2012

What happens when you hit a URL in your Browser !!

Hello all,

     In the link provided below you will find an article which would be useful to all. Many of us don't know the process that going behind the Browser when we hit an URL. This article will give some basic knowledge on that process. 

Monday, 9 July 2012

Finished my First year in the Corporate world !!