Question #260804

Using this online IDE, perform the following.

1. Initialize four (4) variables based on the table below.

Data type Variable NameValue

String firstName Your first name.

String lastName Your last name.

char mi Your middle initial

int faveNumber Your favorite number

String faveCartChar Your favorite cartoon or anime character

2. Create statements that would print an output similar to the sample below. Use '+' to combine words and variable names. 


Expert's answer



public class App {


	public static void main(String[] args) {


		String firstName = "Peter";
		String lastName = "Smith";
		char mi = 'F';
		int faveNumber = 7;
		String faveCartChar = "Finn";
		
		String output="My name is "+firstName+" "+mi+" "+lastName+". "+faveNumber+" is my favorite number. I love "+faveCartChar+"!";
		
		System.out.println(output);
		
	}


}

LATEST TUTORIALS
APPROVED BY CLIENTS