Java Trainer - JT - Home

Tutorials   Language details   Run a program (Tutorial 1)   documentation   

 

Java Trainer (JT) is for students who intend to learn Java , C#(or C++ for that matter). It is a simple programming system in a web page (no install), with a language close to C and Java, but cut-down.

It only covers the very early material of a programming course, and might also be suitable for students who want to make a start on some 'pre-course' work, before attending college. It lets them run short programs(e.g 10-liners) and introduces the 'curly-bracket and semicolon' stuff, without the overhead of code like public static class main args string{ } etc.

Though instructors know that the brackets etc is just punctuation, not concept, students don't often have this view. Java trainer lets them get into variables etc with a low overhead.

Once students get beyond the concepts such as assignment, 'if', 'while', they may be ready for a proper system.

The system also has a built-in code formatter.

Note that objects and events are not covered. This will not suit those who wish an 'objects really early' approach, or who want events from stage 1.

My view is that it is worth knowing about variables, 'if', and maybe passing parameters, and it doesn't hurt to do these first. JT is not compulsory!

Website: www.mikeparr.info/jt/jthome.htm

Unusually, Java Trainer runs within a web page - it does not need installing on your computer. In fact, if the pages are downloaded and saved, it does not need an Internet connection.

Note that programs are not saved in a file. This seems like a drawback,(of course it is) but the advantage is that programs can be copied and pasted from the tutorals. They can then be run instantly. To save them, paste them into e.g Notepad.

Here is some documentation about the system.

Below is a screenshot. It shows a simple program (count numbers and display their sum.) Note the right of the screen, where a list of names and their current values is displayed. It also shows the execution path via executed line numbers.

Using the System

Have a look at tutorial 1

Here is some more info...
Enter a program (or paste in code from the on-line tutorials). Choose 'run' or 'trace'. The line numbers of each assignment statement that is executed is displayed at the top right. Variable values are also displayed, prefixed by the function they are local to.

If you trace, each assignment statement executes, then asks you if you wish to step to the next one. (if you cancel, you will get a Javascript error at line 200. Ignore it, or switch Javascript errors off in your browser. )

Stuck in a loop???? If a large number of lines are executed, a pop-up asks you if you want to stop. If you are stuck in an input loop, type 'quit' as your value.

If you use Mozilla, blank lines cannot be used in the code - I think this is fixable. For now, put a space on a blank line).

What you see:

The Run button was clicked. getInt() pops up a dialog, and a number is entered. We did this 4 times. We used an alert popup to display big and we used print to display the count in the 'console' at the bottom right. (the alert popup has been shut down by the user).

Note the values and line numbers at the top right.

It is really only suitable for short programs, because there is no save/open. (The copy / paste commands can be used to paste to notepad if required.

The Tutorials

.. are a hacked version of a book I wrote years ago, named 'C Simply' which is now under the GPL license.

The Language

You see most of the features in the above program. The if/while statements are checked so that a ; following if/while is errored (no null statement). The { and } must be used, even for a single statement.

NOTE - it is very much an early version - the language is not complete (e.g you can't join strings.)

I very much welcome comments.

Thanks
Mike Parr

EMail: m.parr@shu.ac.uk

Tutorials   Language details   Run a program (Tutorial 1)