A Java string written by yourself. English is relatively poor, please forgive me ~
/***Title :readinput.java*description: //www.25gy.com*copyright: gongtao * @ @ Author: gongtao * @ version: v1.0 * / Package com.gt; import java.io. *; public class readinput {/ * * example: string s = new readinput.getstring (); * @ return: the information of user input * / private int i; private string s = ""; Readinput {try {while ((i = system.in.read ())! = 13) {s = s (char) i;} system.in.read (); // Used to collect 10 ASCII, IEXCEPTION E) {system.out.println (e.tostring ());}} / * * @ Return: string * / public string getString () {return this.s;} / * * @ @ @ @ @ @ @ RETURN: INT * / PUBLIC INT GETINT () {Try {Return New Integer (this.s) .intValue ();} catch (Numberformatexcection E) {system.out.println (e.tostring ()); return 0;} }
}