[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-573477-105":53,"doc-detail-573477-en":126},{"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":119,"head_meta":121,"extra_data":123,"updated_unix":125},105,"en","quick-reference-java-java-17-core-syntax-cheatsheet","QUICK REFERENCE - JAVA - Java 17+ Core Syntax Cheatsheet","","Quick Reference / Java provides an organized, practical cheatsheet for Java 17+ syntax and everyday programming patterns. It covers core language basics including variables and types, operators and conversions, strings, conditions and switch expressions, loops, arrays, and methods. It also summarizes essential object and API concepts such as classes, interfaces, inheritance, records and enums, collections (lists, maps, sets), streams and lambdas, exception handling, and common file I/O using Path and Files.",{"@graph":63,"@context":118},[64,80,101],{"@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/quick-reference-java-java-17-core-syntax-cheatsheet/573477/",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/quick-reference-java-java-17-core-syntax-cheatsheet/573477.png","ImageObject",442,249,{"name":88,"@type":89},"ahduag","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-18","2026-10-14",true,{"@type":98,"interactionType":99,"userInteractionCount":73},"InteractionCounter",{"@type":100},"ViewAction",{"@type":102,"mainEntity":103},"FAQPage",[104,110,114],{"name":105,"@type":106,"acceptedAnswer":107},"How do you compile and run a simple Java program from a single file?","Question",{"text":108,"@type":109},"Save the code as Main.java, compile with javac Main.java, then run with java Main. You can also run the single source file with java Main.java.","Answer",{"name":111,"@type":106,"acceptedAnswer":112},"What are key string rules and how do you compare strings correctly?",{"text":113,"@type":109},"Strings are immutable. Use equals for text equality; == compares object references. Remember that indices start at zero and substring excludes the end index.",{"name":115,"@type":106,"acceptedAnswer":116},"How are lists, maps, and sets used in everyday Java code?",{"text":117,"@type":109},"List preserves order and allows duplicates, maps store unique keys and replace values via put, and sets store unique values. HashMap and HashSet do not guarantee iteration order.","https://schema.org",{"og:url":78,"og:type":120,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":122,"canonical":78},"index,follow",{"doc_id":124,"site_id":56},573477,1792301626,{"code":4,"msg":5,"data":127},{"doc_id":124,"user_id":128,"nickname":88,"user_avatar":129,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":73,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":135,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":136,"faqs":137,"seo_title":138,"seo_description":61,"update_tm":139,"read_time":9},3985747870414,"https://ap-avatar.wpscdn.com/davatar_9964176cb1d06d4a9deccf72a44ae3dc","QUICK REFERENCE / JAVA  \nJava Core syntax for everyday Java 17+.  \n  DevSheets  \n01 / LANGUAGE BASICS  \n 01  Run a Java program  \nclass Main {  \npublic static void main(String[] args) { System.out.println(\"Hello, Java!\");  \n}  \n}  \n[Save as Main.java. Compile with javac Main.java](Save as Main.java. Compile with javac Main.java), then run java Main. Or run the single source file with java [Main.java](Main.java).  \n 02  Variables & types  \nint count = 3 ;  \nlong views = 1000000L; double price = 19.99 ; boolean ready = true; char grade = 'A' ;  \nString name = \"Maya\" ; final int MAX = 10 ;  \nJava is statically typed. var infers a local variable's type from its initializer. final prevents reassignment; it does not freeze an object.  \n 03  Operators & conversion  \nint whole = 7 / 2 ; // 3  \ndouble ratio = 7 / 2.0 ; // 3.5 int remainder = 7 % 2 ; // 1 int age = Integer.parseInt(\"25\"); String text = String.valueOf(age);  \nUse + - * / %, == != \u003C \u003C= > >=, and && || !. Integer division truncates toward zero. Invalid numeric text throws NumberFormatException.  \n 04  Strings  \nString name = \" Maya \" .trim();  \nname.length();  \nname.toUpperCase(); name.contains(\"ay\"); name.substring(0 , 2); name.equals(\"Maya\");  \n// 4  \n// \"MAYA\"  \n// true  \n// \"Ma\"  \n// true  \nStrings are immutable. Use equals for text equality; == compares object references. Indices start at zero; substring excludes its end index.  \n 05  Conditions & switch  \nint score = 82 ;  \nString result = score >= 60 ? \"OK\" : \"Try\" ; String day = \"Sat\" ;  \nboolean weekend = switch (day) { case \"Sat\" , \"Sun\" -> true;  \ndefault -> false;};  \nUse if (condition) { ... } else { ... } for branching. A switch expression returns a value and must cover all possibilities.  \n 06  Loops  \nfor (int i = 0 ; i \u003C 3 ; i++) { System .out .println(i);  \n}  \nint count = 3 ; while (count > 0) {  \ncount--;}  \nbreak exits the nearest loop; continue skips to its next iteration. A do/while loop runs its body at least once.  \n 07  Arrays  \nint[] scores = {80 , 95 , 72}; scores[0] = 85 ;  \nint size = scores.length; for (int score : scores) {  \nSystem .out .println(score);}  \nArrays have a fixed length and zero-based indices. new int[3] creates three zero values. Access outside the bounds throwsan exception.  \n 08  Methods  \nstatic int add(int a, int b) { return a + b;  \n}  \nstatic void greet(String name) { System.out.println(\"Hi, \" + name);  \n}  \nDeclare these inside a class. Call add(2, 3) or greet(\"Maya\"). void means no return value. Java passes arguments by value, including object references.  \n 09  Imports & null  \nimport java .util . List;  \n// Inside a method:  \nString name = null;  \nif (name != null && !name.isBlank()) { System .out .println(name);  \n}  \nImports go above [the class. java.lang](the class. java.lang) is imported automatically. Calling a method on null throws NullPointerException; && short-circuits here.  \nQUICK REFERENCE / JAVA  \nJava Objects, collections, and practical APIs.  \n  DevSheets  \n02 / EVERYDAY JAVA  \n 10  Classes & objects  \nclass User {  \nprivate final String name;  \nUser(String name) { this .name = name; } String name() { return name; }  \n}  \n// Inside a method:  \nUser user = new User(\"Maya\");  \nConstructors initialize instances. this is the current instance. private limits access; public exposes it. static belongs to the class.  \n 11  Interfaces & inheritance  \ninterface Printable { String print();  \n}  \nclass Note implements Printable { public String print() { return \"Hi\" ; }  \n}  \nAn interface defines a contract. A class can implement multiple interfaces but extend only one class. Use @Override when overriding a method.  \n 12  Records & enums  \nrecord Point(int x, int y) {} enum Status { TODO, DONE }  \n// Inside a method:  \nPoint p = new Point(2 , 3); // p.x() is 2 Status state = Status.TODO;  \nRecords provide a constructor, accessors, equals, hashCode, and toString. Fields are final; referenced objects may be mutable. Enums define fixed choices.  \n 13  Lists  \nList\u003CStri","cbCaijlEKtijaZmi","https://ap.wps.com/l/cbCaijlEKtijaZmi","pdf",79962,"English","# 01 / LANGUAGE BASICS\n## 01 Run a Java program\n## 02 Variables & types\n## 03 Operators & conversion\n## 04 Strings\n## 05 Conditions & switch\n## 06 Loops\n## 07 Arrays\n## 08 Methods\n## 09 Imports & null\n# 02 / EVERYDAY JAVA\n## 10 Classes & objects\n## 11 Interfaces & inheritance\n## 12 Records & enums\n## 13 Lists\n## 14 Maps & sets\n## 15 Streams & lambdas\n## 16 Handle exceptions\n## 17 Read & write files\n## 18 Useful standard APIs","[{\"question\":\"How do you compile and run a simple Java program from a single file?\",\"answer\":\"Save the code as Main.java, compile with javac Main.java, then run with java Main. You can also run the single source file with java Main.java.\"},{\"question\":\"What are key string rules and how do you compare strings correctly?\",\"answer\":\"Strings are immutable. Use equals for text equality; == compares object references. Remember that indices start at zero and substring excludes the end index.\"},{\"question\":\"How are lists, maps, and sets used in everyday Java code?\",\"answer\":\"List preserves order and allows duplicates, maps store unique keys and replace values via put, and sets store unique values. HashMap and HashSet do not guarantee iteration order.\"}]","QUICK REFERENCE - JAVA - Java 17+ Core Syntax Cheatsheet | PDF",1791940654]