Computer Science, asked by varshitharavi123, 5 months ago

write a java program and print your name at the same line
can everyone help me ​

Answers

Answered by GucciBoyTae
7

import java.util.Scanner;

class student

{

public static void main(String[]args)

{

Scanner in = new Scanner(System.in);

System.out.println("Enter your name");

String name = in.nextLine();

System.out.println("Enter your roll.no");

int roll_no = in.nextInt();

System.out.println("Enter your class");

int class = in.nextInt();

System.out.println("Name: " + name + "Roll.No: " + roll_no);

System.out.println("Class: " + class);

}

}

Hope this program helps you!!

Answered by singhsundaram999
1

Answer:

//program to print our name//

class Name

{

public static void main(String [] args)

{

System.out.print("Your name"); //use print here//

}

}

Thanks........☺

Similar questions