[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-618693-105":53,"doc-detail-618693-en":127,"doc-similar-618693":149},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":120,"head_meta":122,"extra_data":124,"updated_unix":126},105,"en","cheat-sheet-javacc-stdin-stdout-and-file-io-examples","CHEAT SHEET - Java/C/C++ stdin-stdout and File I/O Examples","","CHEAT SHEET compiles compact examples for Java, C, and C++ showing standard input/output usage (stdin/stdout) and basic file I/O patterns. It provides sample compiler and run commands (javac, gcc, g++) alongside minimal main programs that read values either from redirected input streams or from files, then print formatted results. The sheet also includes example outputs for the given input sequence, enabling quick verification.",{"@graph":63,"@context":119},[64,80,102],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/cheat-sheet-javacc-stdin-stdout-and-file-io-examples/618693/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/cheat-sheet-javacc-stdin-stdout-and-file-io-examples/618693.png","ImageObject",442,249,{"name":88,"@type":89},"Alexandar","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-12-02","2026-10-19",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",6,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"What Java stdin/stdout pattern does the sheet show?","Question",{"text":109,"@type":110},"It reads from standard input using BufferedReader and/or Scanner, processes tokens line by line, prints space-separated values, and ends with a newline.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"How are C stdin/stdout examples compiled and executed?",{"text":114,"@type":110},"The sheet uses gcc with warnings enabled, and runs the compiled program with input redirection from inputFile so scanf reads three integers and printf prints them in reverse-labeled order.",{"name":116,"@type":107,"acceptedAnswer":117},"What does the file I/O section change compared to stdin/stdout?",{"text":118,"@type":110},"Instead of reading from stdin and writing to stdout, it redirects input/output to specific files using FileReader/FileWriter in Java and freopen in C, while keeping the same parsing and output formatting logic.","https://schema.org",{"og:url":78,"og:type":121,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":123,"canonical":78},"index,follow",{"doc_id":125,"site_id":56},618693,1792450029,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":101,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":136,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":61,"update_tm":126,"read_time":9,"preview_page_count":73,"preview_urls":140},962090768658,"https://ap-avatar.wpscdn.com/davatar_6f874abed73319feea01a86fa6f0fab8","CHEAT SHEET  \ninputFile contents  \n1 2 3  \nJava (stdin/stdout)  \n// file: \"[X.java](X.java)\"; compile: \"javac [X.java](X.java)\"; run: \"java X \u003C inputFile\"import [java.io](java.io) .*;  \nimport java .util .*; // check Java API for useful Scanner methods public class X {  \npublic static void main(String[] args) throws IOException {  \nBufferedReader in  \n= new BufferedReader(new InputStreamReader( [System.in](System.in) )); Scanner sc = new Scanner(in .readLine());  \nwhile (sc.hasNext()) System.out.print( [sc.next](sc.next) () + \" \");  \nSystem .out .println();  \n}  \n} // output: \"1 2 3 \"  \nC (stdin/stdout)  \n// file: \"X .c\"; compile: \"gcc -Wall X .c\"; run: \" ./a .out \u003C inputFile\"  \n\\#include \u003Cstdio .h> int main() {  \nint x, y, z;  \nscanf(\"%d %d %d\", &x, &y, &z);  \nprintf(\"z: %d, y: %d, x: %d\\n\", z, y, x);  \nreturn 0;  \n} // output: \"z: 3, y: 2, x: 1\"  \nC++ (stdin/stdout)  \n// file: \"X .cpp\"; compile: \"g++ -Wall X .cpp\"; run: \" ./a .out \u003C inputFile\"  \n\\#include \u003Cstring>  \n\\#include \u003Ciostream>  \n\\#include \u003Csstream> using namespace std; int main() {  \nstring line; int x, y, z;  \ngetline(cin, line);  \nstringstream in(line);  \nin >> x >> y >> z;  \ncout \u003C\u003C \"z: \" \u003C\u003C z \u003C\u003C \", y: \" \u003C\u003C y \u003C\u003C \", x: \" \u003C\u003C x \u003C\u003C endl;  \nreturn 0;  \n} // output: \"z: 3, y: 2, x: 1  \nJava (File I/O)  \n// file: \"[X.java](X.java)\"; compile: \"javac [X.java](X.java)\"; run: \"java X \u003C inputFile\"import [java.io](java.io) .*;  \nimport java .util .*; // check Java API for useful Scanner methods public class X {  \npublic static void main(String[] args) throws IOException {  \nScanner in = new Scanner(new FileReader(\"file .in\"));  \nPrintWriter out = new PrintWriter(new FileWriter(\"file .out\")); while (in.hasNext()) System.out.print( [in.next](in.next) () + \" \");  \nout .println();  \n}  \n} // output: \"1 2 3 \"  \nC (File I/O)  \n// file: \"X .c\"; compile: \"gcc -Wall X .c\"; run: \" ./a .out \u003C inputFile\"  \n\\#include \u003Cstdio .h> int main() {  \nfreopen(\"[file.in](file.in)\", \"r\", stdin);  \nfreopen(\"file .out\", \"w\", stdout);  \nint x, y, z;  \nscanf(\"%d %d %d\", &x, &y, &z);  \nprintf(\"z: %d, y: %d, x: %d\\n\", z, y, x);  \nreturn 0;  \n} // output: \"z: 3, y: 2, x: 1\"","cbCaihcsn36chPjo","https://ap.wps.com/l/cbCaihcsn36chPjo","pdf",62025,"English","# Java (stdin/stdout)\n# C (stdin/stdout)\n# C++ (stdin/stdout)\n# Java (File I/O)\n# C (File I/O)","[{\"question\":\"What Java stdin/stdout pattern does the sheet show?\",\"answer\":\"It reads from standard input using BufferedReader and/or Scanner, processes tokens line by line, prints space-separated values, and ends with a newline.\"},{\"question\":\"How are C stdin/stdout examples compiled and executed?\",\"answer\":\"The sheet uses gcc with warnings enabled, and runs the compiled program with input redirection from inputFile so scanf reads three integers and printf prints them in reverse-labeled order.\"},{\"question\":\"What does the file I/O section change compared to stdin/stdout?\",\"answer\":\"Instead of reading from stdin and writing to stdout, it redirects input/output to specific files using FileReader/FileWriter in Java and freopen in C, while keeping the same parsing and output formatting logic.\"}]","CHEAT SHEET - Java/C/C++ stdin-stdout and File I/O Examples | PDF",[141,145],{"page_no":9,"url":142,"width":143,"height":144},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/755373ed87c272a4c322b0058e480daf.webp",983,1272,{"page_no":73,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/754486a80428cf39ac60ce5a7fa62899.webp",982,1270,{"list":150,"token":60},[151,157,163,170,176,182,188,194,200,207],{"doc_id":152,"doc_title":153,"file_type":134,"home_preview_img_url":154,"slug":155,"view_count":15,"category_name":11,"create_tm":156},573361,"Bash Redirections Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950632633/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=AKy%2FcBVMc82UmmA45v34%2BZMm1lc%3D","bash-redirections-cheat-sheet",1791938003,{"doc_id":158,"doc_title":159,"file_type":134,"home_preview_img_url":160,"slug":161,"view_count":25,"category_name":11,"create_tm":162},571745,"GDB Cheat Sheet - Quick Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950725240/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=SGmPxRl9Sn3lpYuMMZ4s0YFKOkU%3D","gdb-cheat-sheet-quick-reference",1791923528,{"doc_id":164,"doc_title":165,"file_type":134,"home_preview_img_url":166,"slug":167,"view_count":168,"category_name":11,"create_tm":169},573161,"UNIX Command Cheat Sheet - quick reference for common commands","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950599772/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=6CXTElG0HgAx6J9EydIxL3xDk8E%3D","unix-command-cheat-sheet-quick-reference-for-common-commands",13,1791933637,{"doc_id":171,"doc_title":172,"file_type":134,"home_preview_img_url":173,"slug":174,"view_count":8,"category_name":11,"create_tm":175},572632,"C# for Java Developers - Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950581731/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=tE2%2BeJ2kV%2BtSRcfHomayM%2F563b8%3D","c-for-java-developers-cheat-sheet",1791928559,{"doc_id":177,"doc_title":178,"file_type":134,"home_preview_img_url":179,"slug":180,"view_count":40,"category_name":11,"create_tm":181},573357,"All Cheat Sheets - Maven & Git & Java Collections","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950820400/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=kG8W7CD%2FQqTZQAoSEQASiswkASg%3D","all-cheat-sheets-maven-git-java-collections",1791937856,{"doc_id":183,"doc_title":184,"file_type":134,"home_preview_img_url":185,"slug":186,"view_count":20,"category_name":11,"create_tm":187},573478,"Java Cheat Sheet - 1st Edition - Learn core Java basics","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950878964/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=3aksGZx2V20bEfV%2Fas2yny3opVM%3D","java-cheat-sheet-1st-edition-learn-core-java-basics",1791940656,{"doc_id":189,"doc_title":190,"file_type":134,"home_preview_img_url":191,"slug":192,"view_count":15,"category_name":11,"create_tm":193},573840,"Biblatex Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229951292897/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=PZjYZ%2FhrwK3wSonCe24ADE9DpjQ%3D","biblatex-cheat-sheet",1791948142,{"doc_id":195,"doc_title":196,"file_type":134,"home_preview_img_url":197,"slug":198,"view_count":25,"category_name":11,"create_tm":199},574138,"HP Peripherals Cheat Sheet - Quick reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229952235881/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=AQ8My3AyJfrWXWCyxrn8f2EE6mI%3D","hp-peripherals-cheat-sheet-quick-reference",1791979596,{"doc_id":201,"doc_title":202,"file_type":134,"home_preview_img_url":203,"slug":204,"view_count":205,"category_name":11,"create_tm":206},572970,"Windows CMD Commands Cheat Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950588441/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=9w2PZ%2FW7R2rReJsPc12LbWFOL3g%3D","windows-cmd-commands-cheat-sheet",22,1791930313,{"doc_id":208,"doc_title":209,"file_type":134,"home_preview_img_url":210,"slug":211,"view_count":30,"category_name":11,"create_tm":212},573414,"DOCKER CHEAT SHEET - FOR JAVA DEVELOPERS","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229950845858/last/442/249?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796526539&Signature=FJBlA40sskZbCBQ5O56DCZRegVw%3D","docker-cheat-sheet-for-java-developers",1791939395]