1,105,556 Community Members

findInLine(“.”)charat(0);

Member Avatar
nojtb
Newbie Poster
8 posts since Sep 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 
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.

Member Avatar
masijade
Industrious Poster
4,165 posts since Feb 2006
Reputation Points: 1,351 [?]
Q&As Helped to Solve: 510 [?]
Skill Endorsements: 22 [?]
Team Colleague
Featured
 
1
 

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.

Member Avatar
nojtb
Newbie Poster
8 posts since Sep 2008
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
Alex Edwards
Posting Shark
971 posts since Jun 2008
Reputation Points: 321 [?]
Q&As Helped to Solve: 109 [?]
Skill Endorsements: 2 [?]
 
0
 

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

Member Avatar
masijade
Industrious Poster
4,165 posts since Feb 2006
Reputation Points: 1,351 [?]
Q&As Helped to Solve: 510 [?]
Skill Endorsements: 22 [?]
Team Colleague
Featured
 
0
 

First, the API docs, every Programmers best friend.
http://java.sun.com/javase/6/docs/

Second, the official Tutorials, every beginning Programmers second best friend.
http://java.sun.com/docs/books/tutorial/index.html

Third Bruce Eckels "Thinking In Java" 3rd Edition (the 4th Edition is not completely available online, yet).
http://www.mindviewinc.com/downloads/TIJ-3rd-edition4.0.zip

Member Avatar
valy0017
Newbie Poster
1 post since Nov 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

this is the mistake:
in

findInLine(“.”)

you must have

"."

instead of

“.”
You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article