{"id":1893,"date":"2026-08-22T13:14:57","date_gmt":"2026-08-22T13:14:57","guid":{"rendered":"https:\/\/www.allendowney.com\/blog\/?p=1893"},"modified":"2026-08-22T13:14:59","modified_gmt":"2026-08-22T13:14:59","slug":"think-java-but-interactive","status":"publish","type":"post","link":"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/","title":{"rendered":"Think Java, but interactive"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/chrismayfield.github.io\/ThinkJava2\/\">online version of <em>Think Java<\/em><\/a> now features interactive widgets that <strong>run the code examples in the browser<\/strong>. For readers, it means you can try out the examples, modify them, and test your code. And for us it means we can publish an interactive version of the book without providing servers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The widgets use <a href=\"https:\/\/github.com\/ChrisMayfield\/java-runner\">java-runner<\/a>, an in-browser Java editor and interpreter developed by <em>Think Java<\/em> co-author Chris Mayfield.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">java-runner implements a subset of Java with the features needed for most programming classes, plus some safety features &#8212; like a maximum instruction count to stop infinite loops. It provides a code editor and a REPL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s an example of the code editor, from <a href=\"https:\/\/chrismayfield.github.io\/ThinkJava2\/ch06.html#the-while-statement\">Section 6.1<\/a>:<\/p>\n\n\n\n<iframe\n  src=\"https:\/\/chrismayfield.github.io\/ThinkJava2\/embed\/collatz-conjecture.html\"\n  width=\"100%\"\n  height=\"420\"\n  style=\"border:1px solid #e0e0e0;border-radius:6px;\"\n  loading=\"lazy\"\n  title=\"Collatz conjecture \u2014 interactive Java\">\n<\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\">And here&#8217;s an example of the REPL, from <a href=\"https:\/\/chrismayfield.github.io\/ThinkJava2\/ch06.html#characters\">Section 6.6:<\/a>:<\/p>\n\n\n\n<iframe\n  src=\"https:\/\/chrismayfield.github.io\/ThinkJava2\/embed\/fruit-charat-repl.html\"\n  width=\"100%\"\n  height=\"320\"\n  style=\"border:1px solid #e0e0e0;border-radius:6px;\"\n  loading=\"lazy\"\n  title=\"String charAt \u2014 Java REPL\">\n<\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\">We&#8217;re aware of <a href=\"https:\/\/github.com\/ChrisMayfield\/java-runner\/issues\/2\">one example<\/a> where the behavior of java-runner differs from the Java language specification &#8212; so we&#8217;re working on that.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The online version of Think Java now features interactive widgets that run the code examples in the browser. For readers, it means you can try out the examples, modify them, and test your code. And for us it means we can publish an interactive version of the book without providing servers. The widgets use java-runner, an in-browser Java editor and interpreter developed by Think Java co-author Chris Mayfield. java-runner implements a subset of Java with the features needed for most&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[138,140],"class_list":["post-1893","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-java","tag-java-runner"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Think Java, but interactive - Probably Overthinking It<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Think Java, but interactive - Probably Overthinking It\" \/>\n<meta property=\"og:description\" content=\"The online version of Think Java now features interactive widgets that run the code examples in the browser. For readers, it means you can try out the examples, modify them, and test your code. And for us it means we can publish an interactive version of the book without providing servers. The widgets use java-runner, an in-browser Java editor and interpreter developed by Think Java co-author Chris Mayfield. java-runner implements a subset of Java with the features needed for most... Read More Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/\" \/>\n<meta property=\"og:site_name\" content=\"Probably Overthinking It\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-22T13:14:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-22T13:14:59+00:00\" \/>\n<meta name=\"author\" content=\"Allen B. Downey\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@AllenDowney\" \/>\n<meta name=\"twitter:site\" content=\"@AllenDowney\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Allen B. Downey\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/2026\\\/08\\\/22\\\/think-java-but-interactive\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/2026\\\/08\\\/22\\\/think-java-but-interactive\\\/\"},\"author\":{\"name\":\"Allen B. Downey\",\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/#\\\/schema\\\/person\\\/4e5bfb2e9af6c3446cb0031a7bf83207\"},\"headline\":\"Think Java, but interactive\",\"datePublished\":\"2026-08-22T13:14:57+00:00\",\"dateModified\":\"2026-08-22T13:14:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/2026\\\/08\\\/22\\\/think-java-but-interactive\\\/\"},\"wordCount\":152,\"publisher\":{\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/#\\\/schema\\\/person\\\/4e5bfb2e9af6c3446cb0031a7bf83207\"},\"keywords\":[\"java\",\"java-runner\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/2026\\\/08\\\/22\\\/think-java-but-interactive\\\/\",\"url\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/2026\\\/08\\\/22\\\/think-java-but-interactive\\\/\",\"name\":\"Think Java, but interactive - Probably Overthinking It\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/#website\"},\"datePublished\":\"2026-08-22T13:14:57+00:00\",\"dateModified\":\"2026-08-22T13:14:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/2026\\\/08\\\/22\\\/think-java-but-interactive\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/2026\\\/08\\\/22\\\/think-java-but-interactive\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/2026\\\/08\\\/22\\\/think-java-but-interactive\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Think Java, but interactive\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/\",\"name\":\"Probably Overthinking It\",\"description\":\"Data science, Bayesian Statistics, and other ideas\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/#\\\/schema\\\/person\\\/4e5bfb2e9af6c3446cb0031a7bf83207\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/#\\\/schema\\\/person\\\/4e5bfb2e9af6c3446cb0031a7bf83207\",\"name\":\"Allen B. Downey\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/probably_logo.png\",\"url\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/probably_logo.png\",\"contentUrl\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/probably_logo.png\",\"width\":714,\"height\":784,\"caption\":\"Allen B. Downey\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/probably_logo.png\"},\"sameAs\":[\"https:\\\/\\\/www.allendowney.com\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/allendowney\\\/\",\"https:\\\/\\\/x.com\\\/AllenDowney\",\"https:\\\/\\\/github.com\\\/AllenDowney\",\"https:\\\/\\\/bsky.app\\\/profile\\\/allendowney.bsky.social\",\"https:\\\/\\\/allendowney.github.io\\\/Portfolio\\\/\",\"https:\\\/\\\/greenteapress.com\\\/wp\\\/\"],\"url\":\"https:\\\/\\\/www.allendowney.com\\\/blog\\\/author\\\/allen-downey\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Think Java, but interactive - Probably Overthinking It","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/","og_locale":"en_US","og_type":"article","og_title":"Think Java, but interactive - Probably Overthinking It","og_description":"The online version of Think Java now features interactive widgets that run the code examples in the browser. For readers, it means you can try out the examples, modify them, and test your code. And for us it means we can publish an interactive version of the book without providing servers. The widgets use java-runner, an in-browser Java editor and interpreter developed by Think Java co-author Chris Mayfield. java-runner implements a subset of Java with the features needed for most... Read More Read More","og_url":"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/","og_site_name":"Probably Overthinking It","article_published_time":"2026-08-22T13:14:57+00:00","article_modified_time":"2026-08-22T13:14:59+00:00","author":"Allen B. Downey","twitter_card":"summary_large_image","twitter_creator":"@AllenDowney","twitter_site":"@AllenDowney","twitter_misc":{"Written by":"Allen B. Downey","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/#article","isPartOf":{"@id":"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/"},"author":{"name":"Allen B. Downey","@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207"},"headline":"Think Java, but interactive","datePublished":"2026-08-22T13:14:57+00:00","dateModified":"2026-08-22T13:14:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/"},"wordCount":152,"publisher":{"@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207"},"keywords":["java","java-runner"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/","url":"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/","name":"Think Java, but interactive - Probably Overthinking It","isPartOf":{"@id":"https:\/\/www.allendowney.com\/blog\/#website"},"datePublished":"2026-08-22T13:14:57+00:00","dateModified":"2026-08-22T13:14:59+00:00","breadcrumb":{"@id":"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.allendowney.com\/blog\/2026\/08\/22\/think-java-but-interactive\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.allendowney.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Think Java, but interactive"}]},{"@type":"WebSite","@id":"https:\/\/www.allendowney.com\/blog\/#website","url":"https:\/\/www.allendowney.com\/blog\/","name":"Probably Overthinking It","description":"Data science, Bayesian Statistics, and other ideas","publisher":{"@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.allendowney.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.allendowney.com\/blog\/#\/schema\/person\/4e5bfb2e9af6c3446cb0031a7bf83207","name":"Allen B. Downey","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png","url":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png","contentUrl":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png","width":714,"height":784,"caption":"Allen B. Downey"},"logo":{"@id":"https:\/\/www.allendowney.com\/blog\/wp-content\/uploads\/2025\/03\/probably_logo.png"},"sameAs":["https:\/\/www.allendowney.com\/","https:\/\/www.linkedin.com\/in\/allendowney\/","https:\/\/x.com\/AllenDowney","https:\/\/github.com\/AllenDowney","https:\/\/bsky.app\/profile\/allendowney.bsky.social","https:\/\/allendowney.github.io\/Portfolio\/","https:\/\/greenteapress.com\/wp\/"],"url":"https:\/\/www.allendowney.com\/blog\/author\/allen-downey\/"}]}},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts\/1893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/comments?post=1893"}],"version-history":[{"count":4,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts\/1893\/revisions"}],"predecessor-version":[{"id":1897,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/posts\/1893\/revisions\/1897"}],"wp:attachment":[{"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/media?parent=1893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/categories?post=1893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.allendowney.com\/blog\/wp-json\/wp\/v2\/tags?post=1893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}