import java.util.Scanner;
	class ReverseWord {
	public static void main(String args[]) {
	Scanner myScanner = new Scanner(System.in);
	char c1, c2, c3, c4;
		c1 = myScanner.findInLine(“.”).charAt(0);
		c2 = myScanner.findInLine(“.”).charAt(0);
		c3 = myScanner.findInLine(“.”).charAt(0);
		c4 = myScanner.findInLine(“.”).charAt(0);

	System.out.print(c4);
	System.out.print(c3);
	System.out.print(c2);
	System.out.print(c1);
	System.out.println();
	}
}

the code above if you type
stop
in the windows prompt window will put the output of
pots
but im wondering what this part does
charAt(0);

at what would happen if i changed it to
charAt(1);

thanks, i know what the rest does though.

Recommended Answers

All 5 Replies

Why don't you try it and find out?

I'm sorry, but you claim to be jumping into Java quickly, on your own, because you already know a couple of other languages. Well, I need to ask, what "other languages" do you know? Because in that thread you had no idea what "static" was and in this thead, the method you are looking at is extremely self-explanatory if you have nearly any real programming experience at all.

commented: This is so crazy it just might work!! :P +11

Why don't you try it and find out?

I'm sorry, but you claim to be jumping into Java quickly, on your own, because you already know a couple of other languages. Well, I need to ask, what "other languages" do you know? Because in that thread you had no idea what "static" was and in this thead, the method you are looking at is extremely self-explanatory if you have nearly any real programming experience at all.

nothing that related to object oriented, batch, javascript, html, and almost finished php. did a bit in binary but stopped, was a bit of a waste of time...

i got the code off a pdf file whats helping me learn, when i tested it i found 20 errors, witch is probably becasue the books pretty old. and i didint have the time today inbetween reading and working with my brother on his truck so i didint get the time to look into the problems.

plus even if i did test it i may not get the answer im looking for.

Man where is Salem when you need him...

Anyways, yeah Masijade is correct. You should really experiment and try things on your own until you come across an error. Then ask for help =P

this is the mistake:
in

findInLine(“.”)

you must have

"."

instead of

“.”
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.