FatCow Posted September 29, 2014 Share Posted September 29, 2014 I have been given a simple ChatBot program for my Computer Science class, but I do not understand most of the codes and methods included in it Some of the things I do not understand in the program are "psn >= 0", "lastChar", and "substring". If anyone of you guys can spare some of your time to explain these to me, that would be great! I have attached the actual ChatBot file, so you could take a look at it (I had to upload the text file, because I couldn't upload the actual java). Magpie4.txt Link to comment Share on other sites More sharing options...
Sensei Posted September 29, 2014 Share Posted September 29, 2014 (edited) String.substring() returns middle part of string. If length is missing it's probably going to the end of string. lastChar is of course last character, last letter, of the string. That code was checking whether it's dot. psn is variable name. Shortcut from position-index inside of string. Edited September 29, 2014 by Sensei 1 Link to comment Share on other sites More sharing options...
FatCow Posted September 30, 2014 Author Share Posted September 30, 2014 Thank you!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now