Set significant figures in Java Programming language

Posted on July 8, 2008
Filed Under Java | Leave a Comment

How do i set significant figures in Java Programming language?

Java 1.5 offers a printf-like formatting via java.util.Formatter or via the ‘printf’ method of an output stream:

e.g.: System.out.printf(”%.2f”, (double)100); or
String output = String.format(”%.2f”, (double)100);


Tags:

If you enjoyed this post, make sure you subscribe to my RSS feed!

Comments

Create a Java bean for Drop down menu

Posted on July 8, 2008
Filed Under Java | Leave a Comment

How to create a Java bean for Drop down menu?

in the java bean:
u need to create the element as an array, and fill up the elements.
Have getter and setter for the element

in the jsp, u can just call the array and loop it and display the elements in the array.


Tags:

If you enjoyed this post, make sure you subscribe to my RSS feed!

Comments

Check whether a file is opened or not through java

Posted on July 8, 2008
Filed Under Java | 1 Comment

How do i check whether a file is opened or not through java?

I don’t think you can do that. When you ask java to open the file it can read from it. If you don’t open the file in the code, the Java wont see the file at all. You might want to look at the swing libraries, they might have some file manipulation there. Also, make sure that the file you are opening in the directory where the java can read it. Meaning if it in the same place as the code or the total path of the file.

Tags:

If you enjoyed this post, make sure you subscribe to my RSS feed!

Comments