[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-718171-105":59,"doc-detail-718171-en":130,"doc-similar-718171":196},{"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","100-java-programs-with-output-useful-collection-of-java-programs","100+ Java Programs with Output - Useful collection of Java Programs","","A collection of Java programming examples covering foundational syntax and common algorithms. The index lists tasks such as Hello World, matrix addition, Armstrong number checking, binary search, bubble sort, command line arguments, odd/even detection, Fahrenheit to Celsius conversion, and date/time display. It also explains core Java concepts including println vs print behavior, System.out usage, and binarySearch return behavior. Each example includes program code and expected output, supporting quick learning and practical reference.",{"@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/100-java-programs-with-output-useful-collection-of-java-programs/718171/",{"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/100-java-programs-with-output-useful-collection-of-java-programs/718171.png","ImageObject",300,407,{"name":92,"@type":93},"Levi","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-21","2026-11-16",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 is the difference between print and println in Java as described here?","Question",{"text":112,"@type":113},"println prints the argument and moves the cursor to the beginning of the next line, while print does not move to the next line in the same way. The text also notes how println is used with arguments passed to it.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How does the provided binary search explain its return value when an element is not found?",{"text":117,"@type":113},"It states that binarySearch returns the match location if found; otherwise it returns -(x+1), where x is the number of elements in the array. An example mentions a returned value of -6 when a target is absent.",{"name":119,"@type":110,"acceptedAnswer":120},"What defines an Armstrong number in this document, and are there examples?",{"text":121,"@type":113},"An Armstrong number equals the sum of its digits raised to the power of the total number of digits. Examples listed include 0, 1, 4, 5, 9, 153, 371, 407, and 8208.","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},718171,1794855133,{"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":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":129,"read_time":144,"preview_page_count":145,"preview_urls":146},7971461740909,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","By : Aniket Pataskar  \nINDEX  \n1. Hello World example 3  \n2. Add two matrices 4  \n3. Armstrong number 7  \n4. Binary Search 11  \n5. Bubble sort 14  \n6. Command line arguments 17  \n7. Find Odd or Even 18  \n8. Convert Fahrenheit to Celsius 21  \n9. Display Date and Time 23  \n10.Largest of three integers 26  \n11. Java Programs part 1 28  \n12. Java Programs part 2 49  \n13. Java Programs part 3 74  \n14. Java Programs part 4 102  \n15. Java Programs part 5 120  \n16. Java Programs part 6 134  \n17. Java Interview Questions part 1 161 18. Java Interview Questions part 2 178  \n“Hello World” is passed as an argument to println method, you can print whatever you want. There is also a print method which doesn’t takes the cursor to beginning of next line as println does. System is a class, out is object of PrintStream class and println is the method.  \nOutput of program:  \nOutput of program:  \nThis code adds two matrix, you can modify it to add any number of matrices. You can create a Matrix class and create it’s objects and then create an add method which sum the objects, then you can add any number of matrices by repeatedly calling the method using a loop.  \nOutput of program:  \nOther methods of searching are Linear search and Hashing. There is a binarySearch method in Arrays class which can also be used.  \nbinarySearch method returns the location if a match occurs otherwise- (x+1) where x is the no. of elements in the array, For example in the second case above when p is not present in characters array the returned value will be-6.  \nThis java program checks if a number is Armstrong or not. Armstrong number is a number which is equal to sum of digits raise to the power total number of digits in the number. Some Armstrong numbers are: 0, 1, 4, 5, 9, 153, 371, 407, 8208 etc.  \nJava programming code  \nOutput of program:  \nUsing one more loop in the above code you can generate Armstrong numbers from 1 ton(say) or between two integers (a to b) .  \nJava program to bubble sort: This code sorts numbers inputted by user using Bubble sort algorithm.  \nJava programming code  \nComplexity of bubble sort is O(n2 ) which makes it a less frequent option for arranging in sorted order when quantity of numbers is high.  \nOutput of program:  \nOutput :  \nThis java program finds if a number is odd or even. If the number is divisible by 2 then it will be even, otherwise it is odd. We use modulus operator to find remainder in our program.  \nJava programming source code  \nOutput of program:","cbCaisPAf0ZGxJtK","https://ap.wps.com/l/cbCaisPAf0ZGxJtK","pdf",5076637,112,"English","# Index\n## Hello World example\n## Add two matrices\n## Armstrong number\n## Binary Search\n## Bubble sort\n## Command line arguments\n## Find Odd or Even\n## Convert Fahrenheit to Celsius\n## Display Date and Time\n## Largest of three integers\n## Java Programs part 1\n## Java Programs part 2\n## Java Programs part 3\n## Java Programs part 4\n## Java Programs part 5\n## Java Programs part 6\n## Java Interview Questions part 1\n## Java Interview Questions part 2","[{\"question\":\"What is the difference between print and println in Java as described here?\",\"answer\":\"println prints the argument and moves the cursor to the beginning of the next line, while print does not move to the next line in the same way. The text also notes how println is used with arguments passed to it.\"},{\"question\":\"How does the provided binary search explain its return value when an element is not found?\",\"answer\":\"It states that binarySearch returns the match location if found; otherwise it returns -(x+1), where x is the number of elements in the array. An example mentions a returned value of -6 when a target is absent.\"},{\"question\":\"What defines an Armstrong number in this document, and are there examples?\",\"answer\":\"An Armstrong number equals the sum of its digits raised to the power of the total number of digits. Examples listed include 0, 1, 4, 5, 9, 153, 371, 407, and 8208.\"}]","100+ Java Programs with Output - Useful collection of Java Programs | PDF",282,12,[147,151,155,159,163,167,171,175,179,183,187,192],{"page_no":8,"url":148,"width":149,"height":150},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/93797cfcb2b16c351b8de04683a3cf03.webp",983,1390,{"page_no":14,"url":152,"width":153,"height":154},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/092c4c86ad70185aad0ed2a83cb9733b.webp",982,1388,{"page_no":81,"url":156,"width":157,"height":158},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/cbfb76c67722a7f579d8e072c5f91b08.webp",981,1387,{"page_no":19,"url":160,"width":161,"height":162},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/9dd33bcc2bf9e905d8ab8628d1bc6f89.webp",980,1385,{"page_no":24,"url":164,"width":165,"height":166},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/4be488a094f53489e3672e38a2cef944.webp",979,1384,{"page_no":29,"url":168,"width":169,"height":170},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/3fd5c62025666365220f7eaaa5b07b37.webp",978,1383,{"page_no":34,"url":172,"width":173,"height":174},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/24b23bb57d43b98efa689da2a9f481e6.webp",977,1381,{"page_no":39,"url":176,"width":177,"height":178},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/9e8b958020a8c2b9c2789dd9b1f98fd1.webp",976,1380,{"page_no":44,"url":180,"width":181,"height":182},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/eeecc8214c7ac964d869c5b9bff10bc5.webp",975,1378,{"page_no":52,"url":184,"width":185,"height":186},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/58b14bdc77b6acde920f8fd37bc157a0.webp",974,1377,{"page_no":188,"url":189,"width":190,"height":191},11,"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/d4d88c2d490947295069977e823844b8.webp",973,1376,{"page_no":145,"url":193,"width":194,"height":195},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/a275fb076ccb8750227697b7b4d18ef1.webp",972,1374,{"list":197,"token":66},[198,204,210,216,222,229,235,241,247,254],{"doc_id":199,"doc_title":200,"file_type":137,"home_preview_img_url":201,"slug":202,"view_count":14,"category_name":30,"create_tm":203},718167,"JAVA PROGRAMS - Java Practice - number patterns and arithmetic tasks","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230019204730/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110859&Signature=vydcEIe8UXoqb0Jz7yJmy50mJcY%3D","java-programs-java-practice-number-patterns-and-arithmetic-tasks",1794855123,{"doc_id":205,"doc_title":206,"file_type":137,"home_preview_img_url":207,"slug":208,"view_count":81,"category_name":30,"create_tm":209},700990,"MarkLogic Server - Java Application Developer’s Guide - 9 - Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230011575704/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110859&Signature=N7udRgfPYNB4nKRsrGD3Cl6jT%2FA%3D","marklogic-server-java-application-developers-guide-9-reference",1794522640,{"doc_id":211,"doc_title":212,"file_type":137,"home_preview_img_url":213,"slug":214,"view_count":19,"category_name":30,"create_tm":215},700985,"The Hacker's Guide to Javac - An Introduction to Java Compiler Internals","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230012045646/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110859&Signature=wQt1MfP33%2BZHt7UavXL6mmK5J40%3D","the-hackers-guide-to-javac-an-introduction-to-java-compiler-internals",1794522630,{"doc_id":217,"doc_title":218,"file_type":137,"home_preview_img_url":219,"slug":220,"view_count":81,"category_name":30,"create_tm":221},696971,"Introduction to Programming and Data Structures - Comprehensive Version - Twelfth Edition - by Y. Daniel Liang","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230009782731/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110859&Signature=Hbrrb%2FFtp32GAO%2B3vnmzfMlA0aE%3D","introduction-to-programming-and-data-structures-comprehensive-version-twelfth-edition-by-y-daniel-liang",1794435786,{"doc_id":223,"doc_title":224,"file_type":137,"home_preview_img_url":225,"slug":226,"view_count":227,"category_name":30,"create_tm":228},347077,"Thinking in Java - 4th Edition","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229910997714/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110859&Signature=WNR5MPYvI9snRA1L4xmwqffS9Tg%3D","thinking-in-java-4th-edition",18,1790065169,{"doc_id":230,"doc_title":231,"file_type":137,"home_preview_img_url":232,"slug":233,"view_count":227,"category_name":30,"create_tm":234},83311,"LAP: Simple Command-line Tools for Teaching Logic, Algorithms, and Proof in Computer Science","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229808962301/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110859&Signature=iXZfHjS%2FKu6LrbXjPa%2B%2Fe9cPHSo%3D","lap-simple-command-line-tools-for-teaching-logic-algorithms-and-proof-in-computer-science",1784186671,{"doc_id":236,"doc_title":237,"file_type":137,"home_preview_img_url":238,"slug":239,"view_count":29,"category_name":30,"create_tm":240},641073,"GOODMAN GTST - Connected Thermostat - Homeowner Guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229970426806/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110859&Signature=BWGpU0fZjUTdB1ntCRlr1Yts3Ho%3D","goodman-gtst-connected-thermostat-homeowner-guide",1792712655,{"doc_id":242,"doc_title":243,"file_type":137,"home_preview_img_url":244,"slug":245,"view_count":14,"category_name":30,"create_tm":246},734151,"SIM7500 - SIM7600 Series AT - Command Manual - V1.01 - Release","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031822587/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110859&Signature=VE%2BYfeq5Is5cl9I4Nz3041DKBAY%3D","sim7500-sim7600-series-at-command-manual-v101-release",1795390223,{"doc_id":248,"doc_title":249,"file_type":137,"home_preview_img_url":250,"slug":251,"view_count":252,"category_name":30,"create_tm":253},345930,"zipfile and unzipfile - Compress and uncompress files and directories in zip archive format","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229911145605/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110859&Signature=th5nw0n6lWMoRCzdEEP%2B0IcxDJo%3D","zipfile-and-unzipfile-compress-and-uncompress-files-and-directories-in-zip-archive-format",14,1790059425,{"doc_id":255,"doc_title":256,"file_type":137,"home_preview_img_url":257,"slug":258,"view_count":259,"category_name":30,"create_tm":260},423014,"THE JAVA LANGUAGE CHEAT SHEET - quick reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229922611453/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110859&Signature=9a4xUHYzpnePb62zGtUu01Di7L0%3D","the-java-language-cheat-sheet-quick-reference",13,1790629749]