A blue j string manipulation problem(its simple but still i can't figure it out)

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
1/2"
Messages
98
Reaction score
0

Homework Statement


Well this actually a part of a different problem and there i want to make use of subscript function but its giving a funny problem .
it's like this:
public class test
{ void main(String m)
{ int a =m.length(),b=0;
System.out.println(m.subscript(b,a));
}
}


The Attempt at a Solution


When i try to compile this it gives me an error " cannot find symbol - method subscript(int,int)"
So it tried to declare a and b in separate lines and the are obviously int type.
Please can you point out my mistake(It may be very silly ,i know)
Thank you
 
Last edited by a moderator:
Physics news on Phys.org
1/2" said:

Homework Statement


Well this actually a part of a different problem and there i want to make use of subscript function but its giving a funny problem .
it's like this:
public class test
{ void main(String m)
{ int a =m.length(),b=0;
System.out.println(m.subscript(b,a));
}
}


The Attempt at a Solution


When i try to compile this it gives me an error " cannot find symbol - method subscript(int,int)"
So it tried to declare a and b in separate lines and the are obviously int type.
Please can you point out my mistake(It may be very silly ,i know)
Thank you

There is no "subscript" method on the String class - are you thinking of the substring method? See http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html
 
Yes it was substring . Thanks:smile:
I feel so stupid:blushing: for making such a silly mistake!:-p