What's new

Welcome to ComSci.

Welcome to our Computer Science Forum! Dive into discussions, resources, and collaborations with fellow enthusiasts. Let's explore the endless possibilities of technology together!

Ask question

Ask questions and get answers from our community

Answer

Answer questions and become an expert on your topic

Contact us

Contact the site administrator directly.

OOP LAB #1

Chrollo

Administrator
Staff member
Joined
May 11, 2024
Messages
16
Reaction score
0
Points
6
Java:
import java.util.Scanner;

public class Main{
    public static void main (String[] args){
        Scanner s = new Scanner(System.in);
        
    String name, color, friend1, friend2;
    int age;
        
        System.out.print("Enter your Nickname: ");
            name = s.next();
        
        System.out.print("Enter your age: ");
            age = s.nextInt();
        
        System.out.print("Enter your favorite Color: ");
            color = s.next();
        
        System.out.print("Enter your trusted friend1: ");
            friend1 = s.next();
            
        System.out.print("Enter your trusted friend2: ");
            friend2 = s.next();
        
        System.out.println("\n");
        System.out.println("My Personal info: ");
        System.out.println("My nickname is: "+ name);
        System.out.println("I'am "+ age + " years old");
        System.out.println("My Favorite Color is: "+ color);
        System.out.println("My two trusted friend is: "+ friend1 + " and " + friend2);
    }
}
 
shape1
shape2
shape3
shape4
shape5
shape6
Top