1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | String class isEmpty method example String class isEmpty method example:- This method returns boolean value true if and only if . length methodreturns for the object taken under process and returns false if object chosen is not empty that means it has .length() method value greater than zero. Syntax:- isEmpty() Here is the code:- /** * @(#) IsEmptyString.java * IsEmptyString class demonstrates the working of isEmpty() method of String class of lang package */ public class IsEmptyString { public static void main(String args[]) { String heram = new String("heram"); // Method isEmpty() returns boolean value false if and only if length of // the value is zero // .length() method returns the lenght of System.out.println("length of the method is returned: " + heram.length() + "\n" + "Method returns false here: " + heram.isEmpty()); } } Output of the program:- ------------------------------------- length of the method is returned: 5 Method returns false here: false |
It's all about Java development. A place mainly for java programmers.
Monday, 7 May 2012
Java String isEmpty Example
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment