Intermediate Programming - Lab 1
Intermediate Programming - Lab 1
String Manipulation
1. String concatenations
2. Changing the given string's case (e.g. from all caps [CAPS] to
lower case [caps])
3. Sub-string inside a string
4. Cleaning the string with the unwanted character
5. String reverse
6. Parsing
a. .parseInt() is used to get int data from a specific
string, i.e. It converts string to int
String Manipulation
System.out.println("Your age in 20
years is " + futureage);
.parseDouble() String exp;
.print() System.out.print("
- Displays the Hello ");
output on the System.out.print("
same line World");
.printf() int age = 20;
- Allows to us to System.out.printf(
output string "I am %d years
formatted in old", age);
the code using
format
specifiers,
%s for a
string, %c for a
character,
and %d for an
integer.