TextTool class with a method that returns a string in uppercase
Create Project Name: TextUpper
Source Code1: TextTool.java
public class TextTool {
// Method that takes a string and returns it in uppercase
public String toUpper(String text) {
return text.toUpperCase();
}
}
Source Code2: TextUpper.java
public class TextUpper {
public static void main(String[] args) {
TextTool tool = new TextTool();
String result1 = tool.toUpper("hello my student");
String result2 = tool.toUpper("java is fun");
System.out.println("Uppercase: " + result1); // Output: HELLO My STUDENT
System.out.println("Uppercase: " + result2); // Output: JAVA IS FUN
}
}
Result:
Watch the video:

