Static gets serialized..?

Now dont jump into conclusions before you read this.

import java.io.*;
public class Ser implements Serializable {
static int var = 9;

void set() {
var = 100;

public class DumpSer {
public static void main(String[] args) throws Exception {
Ser kk = new Ser();
File outFile = new File("out.dmp");
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(outFile));

public class LoadSer {
public static void main(String[] args) throws Exception {
File inFile = new File("out.dmp");
ObjectInputStream in = new ObjectInputStream(new FileInputStream(inFile));
Ser jj = (Ser)in.readObject();
System.out.println("Val -> "+jj.var);

After compilation, first execute:
> java DumpSer
Then execute:
> java LoadSer
What do you see?

Reason: Once a class is loaded it remains loaded and all its static fields remain set with any values assign to them. The Thumb rule is Statics's are not serialized but initialized.

Kitchen Sink Language

"Throw stuff into the kitchen sink without thinking too hard about whether or not its a good idea. Let folks kick the tires. Those experiences then inform the choice of which features go into the standard. " - James Gosling, 2007

Enjoy and share the fun of being a part of the Java Compiler Community.

Kitchen Sink Language

Dodo Tales: Finally fischy ','

Why did not the complier complain of having a "," as the final element in an array initialization?

List initList = Arrays.asList(new Integer[] {
new Integer(1),
new Integer(2),
new Integer(1),
new Integer(2),

Why is this a part of Java Language Specification ..?


Congrats Mr.James Gosling...

The man credited with inventing the Java programming language commonly used on the World Wide Web has been appointed to the Order of Canada.

James Gosling, a vice-president of Sun Microsystems Inc. of Santa Clara, Calif., has been named an officer of the Order of Canada, the office of the Governor General announced on Monday.

Read on CBC News...


And finally....WoodStock !

A new community of Java participants are developing the next generation of User Interface Components for the web, based on Java Server Faces and AJAX. This open source collaboration enables a community of developers to create powerful and intuitive web applications that are accessible and localizable, and which are based on a uniform set of guidelines and components, to help ensure ease of development and ease of use. This is Project WoodStock

The community adds, "The vision of the Project Woodstock is devoted to providing the best possible web application experience for our customers and communities. That experience will certainly be greatly enriched by the interaction of ideas, information, and techniques that emerge from the cooperation of individuals in the web community, and the rapid introduction of new technologies by members of that community".

This is really an interesting and cool stuff. There are lots of new features that we can do with eaze. Follow the link to know more...



An intelligent compiler...?

Janino is a compiler that reads a JavaTM expression, block, class body, source file or a set of source files, and generates JavaTM bytecode that is loaded and executed directly. Janino is not intended to be a development tool, but an embedded compiler for run-time compilation purposes, e.g. expression evaluators or "server pages" engines like JSP.

JANINO can also be used for static code analysis.

Click here to download Janino


Dodo Tales: if(true) Lies...?

I always wonder, if java worries more about syntax and semantics, Why

if (true);

is considered to be a valid syntax in Java? Why don't the Compiler complain this? what does this line signify?


Free Java Lectures

The Free Java Lectures page bills itself as "two semesters of College-Level Java--for free" offers a comprehensive introduction to Java over the course of 28 sessions, from basic language concepts up through commonly-used libraries like servlets, JSP's, and Struts. Each lecture is a presentation file in .pps format, which can be opened with OpenOffice.org.

Looks good to me...

Lets add few more to wat we know...


Messages in System Tray

Many folks are aware that Java SE 6 comes with the new SystemTray and TrayIcon classes that allows an icon to be added to the system tray - or status area or whatever it is called on your platform. One very cool feature that most articles/pieces don't mention is it is possible to display a message similar to the "Low battery" warning produced by laptops or the "Updates are ready to be installed" alert Windows Update displays so often.

So you wanna try it..?

Click here to get the code

Javascript made simple..!

If your application uses javascript, just give a try with the new framework written completely in javascript. Prototype is a JavaScript Framework that aims to ease development of dynamic web applications.

Here goes a sample snippet:

Instead of,
for (var index = 0; index < myArray.length; ++index) {
var item = myArray[index];
// Your code working on item here...

You can use iterators, such as each :
myArray.each(function(item) {
// Your code working on item here...

There are many overloaded methods and functions too!

Now what are you waiting for...?
Download Prototype from www.prototypejs.org


Href Vs onClick : Anchor tag

< a href="javascript:someFuntion()" > and <
a href="#" onclick="javascript:someFunction()" /> There are many searches that would result in this topic if u #Ooooooogle it..!

I had problems using these functions recently.

I've a common function that would add a popup button to the screen like this,

document.write('< a href="'+href+'" > < img id="'+nam+'_img" border="0" title="'+title+'" src="'+image+'" /> </a >');

The above method was not working when used in popups(showModalDialog). Later i changed the function to return,

document.write('< a href="#" onclick='"+ href +"'> < img id="'+nam+'_img" border="0" title="'+title+'" src="'+image+'"
/> < /a >');

Eurekha it worked...but Why...? Am still to find out the hidden evil in this!


Mystical Yellow form fields

I was surprised to see the fields in one of my web page turning yellow. Itz Google, The Witch here...!

There is an 'AutoFill' option on the Google Toolbar (switched on by default), that will 'helpfully' highlight form fields with certain names such as 'email' or 'name'. The only thing is, I don't think that's particularly helpful. No software program can possibly know what are the most important fields to draw to a users attention. As the designer, I should choose how to best highlight areas and what methods I use to attract users to areas that I think are important. I certainly don't want an automated tool messing up a carefully thought out design.

Read more on http://www.htmldog.com/ptg/archives/000017.php


Kick Off

Dear Friend,

Greetings and Welcome to y(our) own blog!

This is a small initiative to ignite all y(our) creativity here. All of us have different opinions and views on whatever we see and feel. Lets all field it together and step the doors of success.

Get in touch with the blog and remember to post articles and comments.

This would be the place where we can roar and bark JAVA .....

I would appreciate if you can extend all your fullest support for the same.

Lets keep the ball rolling and play the innings together.


Tired of seeing that 500 Bad gateway error while deploying a Springboot application in AWS...?

By default, Spring Boot applications will listen on port 8080. Elastic Beanstalk assumes that the application will listen on port 5000. Th...