• Post Reply Bookmark Topic Watch Topic
  • New Topic

Learn Java the Easy Way: Jshell for teaching  RSS feed

 
German Gonzalez-Morris
Ranch Hand
Posts: 311
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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 ?

Regards,

Germán
 
Bryson Payne
Author
Ranch Hand
Posts: 35
6
Java PHP Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Germán,
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.
Sincerely,
Bryson
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!