0% found this document useful (0 votes)
89 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.
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
89 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.
Copyright
© © All Rights Reserved
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

import [Link].

*;
class LabExer1A{

private String faveCart;


// - Cartoon Character
public void setCart(String cartoon){
faveCart = cartoon;
}
public String getCart(){
return faveCart;
}

public static void main(String args[]) {

LabExer1A lab = new LabExer1A();

Scanner s = new Scanner([Link]);


int faveNumber;
char mi;

[Link]("\n- - - out put - - -\n"+"Enter favourite number : ");


faveNumber = [Link]();

// - Cartoon Char static method


[Link]("Enter favourite cartoon character : ");
String artoon = [Link]();
[Link](artoon);
//

[Link]("Enter middle initial : ");


mi = [Link]().charAt(0);

[Link]("\n- - - out put - - -\n"+faveNumber + " is my favourite number ");

[Link]("I Love " + [Link]() );

char[] nickNameArray = {'B','A','N'};


[Link]("My name is Joebanezair "+mi+" Buatona and you can call me ");
for(int i = 0; i < [Link]; i++)
{ [Link](nickNameArray[i]); }
[Link]("\n \n");

}
}

You might also like