Java Training Course/Example Programs: Difference between revisions
Jump to navigation
Jump to search
imported>Gfis No edit summary |
imported>Gfis v2 |
||
Line 6: | Line 6: | ||
* '''IntMultiply''' - multiply 4 integers 4 times and print the product | * '''IntMultiply''' - multiply 4 integers 4 times and print the product | ||
* '''LongMultiply''' - multiply 4 long numbers | * '''LongMultiply''' - multiply 4 long numbers | ||
===Loops (<code>while, for</code>) and conditions (<code>if</code>)=== | ===Loops (<code>while, for</code>) and conditions (<code>if</code>), arrays (<code>[]</code>)=== | ||
* '''PowersOf2''' - print the powers of 2 | * '''PowersOf2''' - print the powers of 2 | ||
** '''PowersOf2Check''' - check for increasing sequence | ** '''PowersOf2Check''' - check for increasing sequence | ||
** '''PowersOf2Backwards''' - print sequence backwards | ** '''PowersOf2Backwards''' - print sequence backwards | ||
** '''PowersOf2Array''' - print sequence from an array | ** '''PowersOf2Array''' - print sequence from an array | ||
===Sequences of conditions with <code>switch, if - then - else if ...</code>=== | |||
* '''Selamat''' - print a greeting depending on the hour | |||
* '''SelamatSwitch''' - same with <code>switch ... case ... default</code> | |||
* '''Number10''' - print the numbers 1..10 | |||
* '''Number10Method''' - print the numbers using a class method | |||
* '''Month''' - print the indonese name of a month | |||
* '''Weekday''' - print the indonese name of a weekday | |||
===Sequences of words=== | |||
* '''Word1''' - print all words with 1 letter | |||
* '''Word2''' - print all words with 2 letters by 2 nested loops | |||
* '''Word3''' - print all words with 3 letters by 3 nested loops | |||
* '''Word3Cond1''' - print words with 3 letters and vowel/consonant conditions, first version | |||
* '''Word3Cond2''' - same, using a method, 2nd version | |||
* '''Word3Cond3''' - same, output on a single line, 3rd version |
Revision as of 08:32, 13 November 2017
Start with a greeting
- HelloWorld - output only
Arguments, assignment, elementary String and arithmetic operations
- StringAdd - concatenate argument strings 4 times and print them out
- IntAdd - add 4 integers 4 times and print them
- IntMultiply - multiply 4 integers 4 times and print the product
- LongMultiply - multiply 4 long numbers
Loops (while, for
) and conditions (if
), arrays ([]
)
- PowersOf2 - print the powers of 2
- PowersOf2Check - check for increasing sequence
- PowersOf2Backwards - print sequence backwards
- PowersOf2Array - print sequence from an array
Sequences of conditions with switch, if - then - else if ...
- Selamat - print a greeting depending on the hour
- SelamatSwitch - same with
switch ... case ... default
- Number10 - print the numbers 1..10
- Number10Method - print the numbers using a class method
- Month - print the indonese name of a month
- Weekday - print the indonese name of a weekday
Sequences of words
- Word1 - print all words with 1 letter
- Word2 - print all words with 2 letters by 2 nested loops
- Word3 - print all words with 3 letters by 3 nested loops
- Word3Cond1 - print words with 3 letters and vowel/consonant conditions, first version
- Word3Cond2 - same, using a method, 2nd version
- Word3Cond3 - same, output on a single line, 3rd version