0

im trying to debug the following code, and i have breaked at line w= w+ inputString.substring(firsti,i)+"yay"; but debugger shows blank (source not found) what's going on?

public String translate (String inputString) { String w = ""; int firsti =0; for(int i=0; i< inputString.length(); i++){ if(isVowel(inputString.charAt(i))){ firsti = i; while (inputString.charAt(i) != ' ' || i< inputString.length()){ i++; } w= w+ inputString.substring(firsti,i)+"yay"; System.out.println(w); } } String outputString = new String(inputString); // Copies input to output and prints it. return outputString; } 
0

2 Answers 2

1

You might be trying to get into substring() method which is inside java API. You need to attach Java source to debug substring()

How to attach source:

Go to Project > Properties > Java Build Path > Libraries and expand JRE System Library JRE Version then, rt.jar. Select Source attachment, click Edit…. Select the source code file (External File…) and press OK

Read this link for more info.

Sign up to request clarification or add additional context in comments.

Comments

0

You need to add your source code in the debug configuration:

Perform the Steps below:

Option1:

Right Click(Java Source) -> Debug As -> Java Applications 

Option2: If option1 doesn't help:

Menu ->Run ->Debug Configurations..-> Java Applications -> RightClick & select New In right side, Enter Name Browse your Project and the class having `main` method In Classpath, add your project from workspace Click Debug button in the bottom 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.