[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-670905-105":59,"doc-detail-670905-en":130},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","java-cheat-sheet-notes","Java Cheat Sheet - Notes","","Concise Java reference notes from the University of Virginia Department of Computer Science, authored by Dr. Mark R. Floryan. Covers core language rules for code structure, semicolon requirements, class-file naming, and the main entry point. Summarizes primitive types, basic operators, keyboard/file input and console/file output using common standard classes. Includes string concepts and frequent operations, type conversions between primitives and strings, array instantiation and access, looping patterns, and essential methods from Java’s Math class.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/java-cheat-sheet-notes/670905/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/java-cheat-sheet-notes/670905.png","ImageObject",300,407,{"name":92,"@type":93},"Bintang","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-03","2026-11-01",true,{"@type":102,"interactionType":103,"userInteractionCount":14},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"What general formatting rules does the Java cheat sheet emphasize?","Question",{"text":112,"@type":113},"All code must be inside a class definition (except import and package statements), and every code line must end with a semicolon. It also notes that whitespace does not matter to the Java compiler.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How does the cheat sheet describe the Java entry point?",{"text":117,"@type":113},"It states that classes can contain a method signature `public static void main(String[] args)` as the entry point to the whole program.",{"name":119,"@type":110,"acceptedAnswer":120},"Which standard classes are shown for input, and what basic operations are used?",{"text":121,"@type":113},"For keyboard input it uses `Scanner` with methods like `nextInt`, `nextDouble`, `nextFloat`, `nextBoolean`, `nextLong`, and `next`. For file input it uses `BufferedReader` with `readLine` and shows closing the reader after reading.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},670905,1793572659,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":14,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":24,"language":139,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":67,"update_tm":129,"read_time":143},962085564381,"https://ap-avatar.wpscdn.com/davatar_6f874abed73319feea01a86fa6f0fab8","University of Virginia, Department of Computer Science  \nJava Cheat Sheet  \nDr. Mark R. Floryan  \nSeptember 3, 2018  \n1 Java: General Things to Remember  \n1. All code must be inside of a class deﬁnition (except import and package statements) .  \n2. Every line of code must end with a semi-colon. This excludes lines that formulate\"blocks\", like if(), while(), or class declarations.  \n3. The name of the class in a ﬁle must match the name of the ﬁle. For example,\"public class LinkedList\" must be in a ﬁle called \"[LinkedList.java](LinkedList.java)\"  \n4. Classes can contain a method \"public static void main(String[] args)\" as an entry point to the whole program.  \n5. Whitespace does NOT matter in java. The compiler will completely ignore all whitespace.  \n2 Primitive Data Types  \nThe primitive variable types are:  \n1 int x = 5; // integers  \ndouble d = 3 . 4; // decimal values  \n3 char c = 'h ' ; // characters . Use single quotes . boolean b = false ; // true or false  \n5  \n/* Other much less commonly used */  \n7 byte b = 24 b ; short s = -8 s ;  \n9 long l = 2000000; float = 4 . 567;  \nSome examples of using these data types include:  \nint x ; // automatically set to 0 by default  \n2 x ++; // increment integer by 1  \nx- - ; // decrement integer by 1  \n4  \nint z = 14;  \n6  \nint total = ( x + z ) * x ; // expressions  \n8 int remainder = x % z ; // remainder after x / z  \n10 /* Boolean operators */ boolean b1 = false ;  \n12 boolean b2 = true ; boolean result ;  \n14  \n16  \nresult = b1 && b2 ;  \nresult = b1 || b2 ;  \nresult = ! b1 ;  \n// logical  \n// logical  \n// logical  \nAND  \nOR negation  \n3 Input Output  \nInput from the keyboard can be done like this:  \n1 Scanner in = new Scanner ( System . in ); int x = in . next Int ();  \n3 double y = in . nextDouble (); float f = in . nextFloat ();  \n5 boolean b = in . nextBoolean (); long l = in . nextLong ();  \n7 String [s = in . next](s = in . next) ();  \n// make a scanner object // read int from keyboard // read double from keyboard // read float from keyboard  \n// read bool from keyboard  \n// read long from keyboard // read string from keyboard  \nInput from a ﬁle can be done like this:  \n1 BufferedReader in =  \nnew BufferedReader ( new FileReader ( \" inputfile . txt \" ));  \n3 String text = in . readLine (); // reads the next line in . close ();  \nOutput to the console is done like this:  \n// prints text concatenated with x  \n2 System . out . print ( \" The answer is \" + x );  \n4 // print s and moves cursor to next line System . out . print ln ( \" something else \" );  \nOutput to a ﬁle can be done like this:  \n1 PrintWriter outFile =  \nnew PrintWriter ( new FileWriter ( \" outputfile . txt \" )));  \n3 outFile . print ( \" Hello \" ); outFile . print ln ( \" world \" );  \n5 outFile . close ();  \n4 Strings  \nStrings are reference types in Java (so they are NOT primitives) .  \n1  \n3  \nString  \nString  \nString  \ns1 = \" Hello \" ;  \ns2 ;  \ns3 = new String ( \" Hi \" );  \n// example string  \n// \"\" empty string by default // Also makes a string  \nCommon operators on strings include:  \n1 String result ;  \n3 result = s1 + s2 ; // \" hi \" + \" there \" = \" hi there \"s1 . length (); // returns length of string  \n5 s1 . charAt (2); // accesses the char at position 2 ( indexed from 0) s1 . substring (1 ,3); // part of string from index 1 to 3 ( exclusive )  \n7 s1 . equals ( s2 ); // compare strings using this structures1 . toUpperCase (); // returns the string as all uppercase  \n9 s1 . toLowerCase (); // returns the string as all lowercase  \n5 Converting Between Data Types  \nIn Java, we often need to convert between diﬀerent types of variables. Here are some  \ncommon conversions:  \n1 /* int ( or any other primitive ) to string */ int x = 5;  \n3 String s = \" \" + x ; // \"\" + variable concatenates as a string  \n5 /* String version of number to int or double */  \nint i = Integer . parse Int ( \" 123 \" ); // converts string \"123\" into intege  \n7 double d = Double . parseDouble ( \" 3.14 \" ) // converts string \"3 . 14\" into dou","cbCaiiapSEMjEziZ","https://ap.wps.com/l/cbCaiiapSEMjEziZ","pdf",132152,"English","# Java: General Things to Remember\n# Primitive Data Types\n# Input Output\n# Strings\n# Converting Between Data Types\n# Arrays\n# Java Math Library","[{\"question\":\"What general formatting rules does the Java cheat sheet emphasize?\",\"answer\":\"All code must be inside a class definition (except import and package statements), and every code line must end with a semicolon. It also notes that whitespace does not matter to the Java compiler.\"},{\"question\":\"How does the cheat sheet describe the Java entry point?\",\"answer\":\"It states that classes can contain a method signature `public static void main(String[] args)` as the entry point to the whole program.\"},{\"question\":\"Which standard classes are shown for input, and what basic operations are used?\",\"answer\":\"For keyboard input it uses `Scanner` with methods like `nextInt`, `nextDouble`, `nextFloat`, `nextBoolean`, `nextLong`, and `next`. For file input it uses `BufferedReader` with `readLine` and shows closing the reader after reading.\"}]","Java Cheat Sheet - Notes | PDF",13]