Win a copy of Spring Boot in Practice this week in the Spring forum!

Srikanth Ramu

Ranch Hand
+ Follow
since Feb 20, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Srikanth Ramu

I guess you want to know the length of each token. You can use string.length():

String token = stringTokenizer.nextToken();
int length = token.length();

Hope this helps
15 years ago
Your second option is not a valid one and you need to specify the type either in new objecttype() statement or separtely. C
heck your code you should find statments like:

15 years ago
# does not come under the permissible identifier part. Check using Character.isJavaIdentifierPart('#') which will return false. For more information refer:

"Naming" section: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/variables.html

"3.8 Identifier" section: http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html
15 years ago
The double quotes can be removed in many ways.

1) Use replaceALL method by escaping the double quotes with \ character (replaceAll("\"","")).

2) Use substring etc
15 years ago
Refer below link to know about Classpath setting:
http://faq.javaranch.com/view?HowToSetTheClasspath

Difference between Classpath and Path can be viewed in below post:

https://coderanch.com/t/407122/java/java/CLASSPATH-vs-PATH
15 years ago
The i value is first incremented in catch block and then in finally block. BTW why do you want to increment the value in catch and finally instead you could do it after finally block
15 years ago
Userdefined exceptions are always Runtime and when you write your own exception then it should extend any java defined Runtime exceptions like Exception, FileNotFoundException etc.

Compile time errors are jdk level errors like syntax errors, identifier errors etc. Hope this helps.
15 years ago
In Wrapper class you will find several utility methods for eg: Integer has method to convert an int to a String and a String to an int etc, Character has methods to change the cases, check for digits, identify spaces etc
15 years ago
Class.forName() returns the "Class" object associated with ABC() and not a new instance of ABC().

For more details refer:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html
15 years ago
To compare the values of string use equals() method. For more details refer below post:

https://coderanch.com/t/262929/java-programmer-SCJP/certification/equals

Refer below link for Enhanced for loop

http://java.sun.com/docs/books/tutorial/java/nutsandbolts/for.html
15 years ago
If Class B extends Class A then you can directly use the variables of Class A provided they are not private variables.
15 years ago



For month the representation is MM and m represents minute in hour. For more details refer:

http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html
15 years ago