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

In summary, the conversation is about a problem with using the substring method in Java. The person is trying to use the method in their code but it is giving an error. They realize their mistake and feel embarrassed about it.
  • #1
1/2"
99
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
  • #2
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
 
  • #3
Yes it was substring . Thanks:smile:
I feel so stupid:blushing: for making such a silly mistake!:-p
 

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

1. What is the blue j string manipulation problem?

The blue j string manipulation problem is a simple coding problem that involves manipulating strings in the BlueJ programming environment. It is often used as an introductory exercise in computer science courses.

2. What are the main steps to solving the blue j string manipulation problem?

The main steps to solving the blue j string manipulation problem are: understanding the problem, breaking it down into smaller tasks, writing the code to complete each task, and testing and debugging the code to ensure it is working correctly.

3. What are some common mistakes when trying to solve the blue j string manipulation problem?

Some common mistakes when trying to solve the blue j string manipulation problem include: not properly understanding the problem, forgetting to use string methods or syntax, and not testing the code thoroughly before submitting it.

4. Do I need to have prior coding experience to solve the blue j string manipulation problem?

No, the blue j string manipulation problem is designed to be a beginner-level coding exercise. However, some basic knowledge of programming concepts and syntax will be helpful in solving the problem.

5. Are there any resources or tips for solving the blue j string manipulation problem?

Yes, there are many online resources and tutorials available to help you solve the blue j string manipulation problem. Some tips include: breaking the problem down into smaller tasks, using string methods and functions, and testing your code as you go. It may also be helpful to consult with a classmate or teacher for assistance.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
12
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
18
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Programming and Computer Science
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
11
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
770
Back
Top