Created
May 6, 2016 09:15
-
-
Save josephkandi/f18a3ca240d065a1bec1a1a31981ae0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StringDemo { | |
public static void main (String[] args) { | |
//The String data type is used to hold a sequence of characters | |
//We use double quotes to enclose the value of the String | |
String username = "joseph"; | |
String email = "john.doe@example.com"; | |
System.out.println("username " + username); | |
String firstName = "Joseph"; | |
String lastName = "Kandi"; | |
//We can use the + operator to join String values together | |
String fullName = firstName +" "+ lastName; | |
System.out.println("fullName " + fullName); | |
//The String type is an object type | |
//It comes with several functions or method to operate on its data | |
//toUpperCase() is a method on the String class. | |
//We will discuss objects and method later, for now, toUpperCase() makes the value uppercase | |
String fullNameCapitalized = fullName.toUpperCase(); | |
System.out.println(fullNameCapitalized); | |
//TODO | |
//Try figure out how to change the name to lower case | |
//Create a variable with your own first name | |
//Create a variable last name | |
//Print your first name in lowercase to the console | |
//Print your last name value in uppercase | |
//Join your lowercase first name with your uppercase last name | |
//Print the result to the console | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment