This Java code defines a class called LabExer1A that contains a method to set and get a favorite cartoon character. The main method prompts the user to input a favorite number, cartoon character, and initial. It then outputs the favorite number, retrieved cartoon character, and constructs a nickname from initial and array.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
70 views1 page
Source Code
This Java code defines a class called LabExer1A that contains a method to set and get a favorite cartoon character. The main method prompts the user to input a favorite number, cartoon character, and initial. It then outputs the favorite number, retrieved cartoon character, and constructs a nickname from initial and array.
System.out.println("\n- - - out put - - -\n"+faveNumber + " is my favourite number ");
System.out.println("I Love " + lab.getCart() );
char[] nickNameArray = {'B','A','N'};
System.out.print("My name is Joebanezair "+mi+" Buatona and you can call me "); for(int i = 0; i < nickNameArray.length; i++) { System.out.print(nickNameArray[i]); } System.out.println("\n \n");