findInLine(“.”)charat(0);

Reply

Join Date: Sep 2008
Posts: 8
Reputation: nojtb is an unknown quantity at this point 
Solved Threads: 0
nojtb nojtb is offline Offline
Newbie Poster

findInLine(“.”)charat(0);

 
0
  #1
Sep 10th, 2008
  1. import java.util.Scanner;
  2. class ReverseWord {
  3. public static void main(String args[]) {
  4. Scanner myScanner = new Scanner(System.in);
  5. char c1, c2, c3, c4;
  6. c1 = myScanner.findInLine(“.”).charAt(0);
  7. c2 = myScanner.findInLine(“.”).charAt(0);
  8. c3 = myScanner.findInLine(“.”).charAt(0);
  9. c4 = myScanner.findInLine(“.”).charAt(0);
  10.  
  11. System.out.print(c4);
  12. System.out.print(c3);
  13. System.out.print(c2);
  14. System.out.print(c1);
  15. System.out.println();
  16. }
  17. }

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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,364
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is online now Online
Nearly a Posting Maven

Re: findInLine(“.”)charat(0);

 
1
  #2
Sep 11th, 2008
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.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 8
Reputation: nojtb is an unknown quantity at this point 
Solved Threads: 0
nojtb nojtb is offline Offline
Newbie Poster

Re: findInLine(“.”)charat(0);

 
0
  #3
Sep 11th, 2008
Originally Posted by masijade View Post
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.
Last edited by nojtb; Sep 11th, 2008 at 3:08 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 973
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Solved Threads: 107
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Posting Shark

Re: findInLine(“.”)charat(0);

 
0
  #4
Sep 11th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,364
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is online now Online
Nearly a Posting Maven

Re: findInLine(“.”)charat(0);

 
0
  #5
Sep 11th, 2008
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...edition4.0.zip
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 1
Reputation: valy0017 is an unknown quantity at this point 
Solved Threads: 0
valy0017 valy0017 is offline Offline
Newbie Poster
 
0
  #6
18 Days Ago
this is the mistake:
in
  1. findInLine(“.”)
you must have instead of
Last edited by valy0017; 18 Days Ago at 5:13 am. Reason: wrong cODE TAG PLACEMENT
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC