Srikanth Ramu

Ranch Hand
+ Follow
since Feb 20, 2007
Merit badge: grant badges
For More
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
16 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:

16 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
16 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
16 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
16 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
16 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.
16 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
16 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
16 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
16 years ago
If Class B extends Class A then you can directly use the variables of Class A provided they are not private variables.
16 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
16 years ago