any one help me in completing my program on FLAMES game
i am not getting how to complete it
please help me
sharathg.satya
-10
Posting Whiz in Training
Recommended Answers
Jump to PostWhy is it null?
Jump to PostThis demonstrates a usage of replaceAll:
System.out.println("XaXbXc".replaceAll("X", "")); // prints> abc
or in two statements:
String res = "XaXbXc".replaceAll("X", ""); System.out.println("res=" + res); // res=abc
Jump to Postits giving an error
What is the error? You need to post its full text.
Jump to PostStringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.charAt(Unknown Source)
at GameFlames.calculateInFlames(GameFlames.java:188)Look at your code at line 188. The index for charAt has an invalid value of -1.
Check how that index is being set and correct the logic so that you do not use an invalid index.
Jump to PostDid you find the call to the charAt() method?
Did you see how the value of the index can be -1?
You need to add a test in your code to be sure that the index is valid before using it.
All 61 Replies
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
NormR1
563
Posting Sage
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.