Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Learn Java the Easy Way: Jshell for teaching

Ranch Hand
Posts: 369
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

It's good to see you here, I am interesting in teaching (I've done some). and I wonder why you mentioned:

especially the new JShell! It's a terrific teaching/learning tool for easing your way into Java.

Which aspect do you review in your book about Jshell and teaching ?


Posts: 35
Python PHP Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great question - thanks for posting!
In the "old days" before Java 9, even a "hello world" program required a class declaration (try explaining that to new coders), a "public static void main(String[] args)", and finally, a System.out.println("Hello"); - followed by that crucial semicolon and two closing braces. Then, save the file with the same name as the class, then compile, then run.
Typos, problems with uppercase/lowercase, general confusion, and you could spend a significant chunk of a class period getting their first line of code to work, without even explaining what the other two lines of code really do (the public class and public static void main seem like mystical incantations from a Java spell book...).
Maybe I'm exaggerating, but not much  
Now, we can fire up JShell, and type:

(Notice no semicolon needed at the end of a single command!) JShell will reply with Hello! - and just like Python's Shell, you can evaluate expressions, test a few lines of code to see how Java actually works without coding a "driver" class, try loops, even build interactive, windowed apps (a few chapters in...):

All of this is possible in JShell - it's the Python-like beginner-friendly gateway to Java we've been waiting for (for a couple of decades).
If you haven't played around with JShell in JDK 9, I highly recommend it, especially for teachers.
Thanks again for the great question, and I hope you'll give JShell a try, especially when working with new coders.
    Bookmark Topic Watch Topic
  • New Topic