- From Bing: Write a Java program that reads an integer between 0 and 1000 and adds all the digits in the integer. For example, if an integer is 932, the sum of all its digits is 14.
- From PoE: Write a program that takes a string as input and checks if the string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same backward as forward.
- Remind me from using
maven
to build source code - To run a
main
function of a classjava -classpath .\target\classes\ dev.ducminhgd.numeric.Sum
.
From PoE:
- List of Fibonacci number to N.
- Count vowels in a string
- Remind me of recursive function.
java.util.List
is an interface, so you cannot useList<Integer> l = new List<Integer>();
. Usenew ArrayList<Integer>()
instead.java.util.Array
is a fixed size type, all elements must be the same type. Data is located on continuous memory zone.java.util.ArrayList
is a dynamic size type. It can contain both primitive type or Object type. If T is an Object Type,ArrayList
can contain T's inheritances.Integer
is a wrapper class ofint
, and provides methods that working with thatint
value.- Default value of an
int
variable is0
, and default value ofInteger
is null. Integer
can be contained in a Java Collection type, butint
.
- Default value of an
- Use
"aeiou".indexOf(c)!=-1
to check if c is one of the five vowels or not.
- Review syntax with
Sum.SumToN
,Sum.SumOddToN
, andSum.SumEvenToN
. - Remind me of inputting from Console.