Chakra Yadavalli

Subscribe to Chakra Yadavalli: eMailAlertsEmail Alerts
Get Chakra Yadavalli: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Top Stories by Chakra Yadavalli

First, let's take another look at the printf snippet. If you are using the Eclipse 3.1M1 or Eclipse 3.0/Cheetah0.0.6 workspace, it would have probably given a compile error that the class java.io.PrintStream has no method that corresponds to printf(String, int, int, int). This is because the required Tiger features are not yet supported by Eclipse. However, our Ant build file successfully compiles the code as it uses uses JDK 1.5.0 compiler. int i = 0; System.out.printf("%d %d %d", ++i, ++i, ++i); // Eclipse 3.1M1 shows compile error. In order to understand how variable argument methods are declared, let's take a look at the Javadoc of printf. We see that the arguments to this method are defined as Object.... The ellipsis (...) denotes that there can be zero or more arguments of the specified type (in this case the type is java.lang.Object). PrintStream printf( Strin... (more)

J2SE 5.0 Static Imports: To Use or Not to Use?

A few weeks ago, I started experimenting with J2SE 5.0 "Tiger" and Eclipse 3.1M1. My first impression of Tiger was that its features are motivated by the claims of .NUTs: "Java code is very verbose whereas Language X's code is shorter and sweeter!" To calm them down, Tiger brings lots of conveniences to the J2SE 5.0 programmer - viz., auto-boxing, static imports, enums, varargs, enhanced for loop, generics, and concurrent utils. Though the concepts behind these features are not new to programming in general, their implementation in J2SE 5.0 is intriguing because these features ar... (more)

Java 5.0 - Tiger: A Classic printf Snippet from the Past

I just downloaded J2SE 1.5/5.0 "Tiger" Beta and started playing with it. First, I could not get the Cheetah and the Tiger to play together. For those who joined the game late (like me), Cheetah is the early preview of Eclipse's future support for J2SE 1.5. It is is not part of the Eclipse 3.0 release. If anyone got these two cubs in a cage and under control, please leave a comment or at least a link to how to make these two get along. Thanks in advance. After a usual, HelloWorld program, I wanted to explore the new printf feature of the java.io.PrintStream. Given that this is adv... (more)