CSE 2221 Final: CSE 2221 Output, Strings, Input Notes

244 views1 pages

Document Summary

The osu cse components provide a simple way to provide output to a user via the console or a file. Closing output co(cid:374)soleout. pri(cid:374)t(cid:894)(cid:862)pro(cid:373)pt: (cid:862)(cid:895); consoleout. println(); fileout. pri(cid:374)tl(cid:374)(cid:894)(cid:862)a li(cid:374)e. (cid:863)(cid:895): when you are done writing output to a simplewriter stream, you must close the stream: consoleout. close(); fileout. close(); Java has special features to deal with character strings. Character-string constants, also called string literals, are enclosed in double quotes, e. g. (cid:862)hello world! (cid:863) Character strings can be concatenated using the + operator, e. g. (cid:862)hello (cid:862) + (cid:862)world! (cid:863) You may declare a string variable, and assign an initial character-string value to it, as follows: Tri(cid:374)g cheer = (cid:862)go(cid:863); cheer = cheer + (cid:862) bucks! (cid:863); The osu cse components provide a simple way to get input from a user via the keyboard or a file.