0% found this document useful (0 votes)
14 views8 pages

Arrays Java

The document contains multiple Java classes that demonstrate basic input and output operations using the Scanner class. It allows users to enter student information such as name, age, and course, and then displays a greeting message for each student. Additionally, it showcases the use of an ArrayList to manage a list of characters.

Uploaded by

Liza Dazer
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views8 pages

Arrays Java

The document contains multiple Java classes that demonstrate basic input and output operations using the Scanner class. It allows users to enter student information such as name, age, and course, and then displays a greeting message for each student. Additionally, it showcases the use of an ArrayList to manage a list of characters.

Uploaded by

Liza Dazer
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

public class Main {

public static void main(String[] args) {

[Link]("Liza Dazer");

// String name = "";

// int age = 0;

// String course = "";

String name [] = new String [5];

int age [] = new int[5];

String course []= new String [5];

Scanner li = new Scanner ([Link]);

try{

for (int i = 0; i<2; i++){

[Link]("Enter name");

name [i]=[Link]();

[Link]("Enter age");

age [i]= [Link]();

[Link]();

[Link]("Enter course");

course [i]= [Link]();


}

for (int i = 0; i<2; i++){

[Link]("Good morning " + name[i]);

[Link]("You are %d years old \n", age[i]);

[Link]("Welcome to " + course[i]);

[Link]("-----");

catch(Exception e){

public class Main {


public static void main(String[] args) {

[Link]("Liza Dazer");

// String name = "";

// int age = 0;

// String course = "";

String name [] = new String [5];

int age [] = new int[5];

String course []= new String [5];

Scanner li = new Scanner ([Link]);

try{

for (int i = 0; i<2; i++){

[Link]("Student #"+(i+1)+" info");

[Link]("Enter name: ");

name [i]=[Link]();

[Link]("Enter age: ");

age [i]= [Link]();

[Link]();

[Link]("Enter course: ");


course [i]= [Link]();

for (int i = 0; i<2; i++){

[Link]("Good morning " + name[i]);

[Link]("You are %d years old \n", age[i]);

[Link]("Welcome to " + course[i]);

[Link]("-----");

catch(Exception e){

public class Main {

public static void main(String[] args) {

[Link]("Liza Dazer");
// String name = "";

// int age = 0;

// String course = "";

String name [] = new String [5];

int age [] = new int[5];

String course []= new String [5];

int num = 0;

Scanner li = new Scanner ([Link]);

try{

[Link]("Enter number of students: ");

num = [Link]();

[Link]();

for (int i = 0; i<2; i++){

[Link]("Student #"+(i+1)+" info");

[Link]("Enter name: ");

name [i]=[Link]();
[Link]("Enter age: ");

age [i]= [Link]();

[Link]();

[Link]("Enter course: ");

course [i]= [Link]();

for (int i = 0; i<2; i++){

[Link]("Good morning " + name[i]);

[Link]("You are %d years old \n", age[i]);

[Link]("Welcome to " + course[i]);

[Link]("-----");

catch(Exception e){

import [Link].*;

public class Hello {

public static void main(String[] args) {

[Link]("Liza Dazer");
int num[]= new int[5];

Scanner li = new Scanner ([Link]);

try{

for (int i = 0; i<5; i++){

[Link]("Enter num");

num[i] = [Link]();

import [Link].*;

public class Main {

public static void main(String[] args) {

// int num = 100;

// String section [] = new String [num];

// [Link]("Length:" + [Link]);

ArrayList<String> chara = new ArrayList<String>();

[Link]("Mario");

[Link](chara);

[Link]("Luigi");

[Link](chara);

[Link]("Peach");

[Link](chara);

[Link](1, "Yoshi");
[Link](chara);

[Link](0, "Toad");

[Link](chara);

[Link]("Value is index 2: " + [Link](2));

You might also like