Computer Science, asked by rahulmohan, 1 year ago

write a program to print your name and age


Anonymous: Can I write C program or Java program
rahulmohan: java program
Anonymous: Kk

Answers

Answered by Anonymous
2
Hello friend..!!

import java.io.*;
Class details
{
public static void main( String args[]) throws IOException
{
System.out.println("My name is Nethu and my age is 20");
}
}
Hope you understood

Anonymous: Please like my answer and mark as branliest
rahulmohan: it is a wrong program
rahulmohan: check it in your computer
Anonymous: Any syntax errors
Anonymous: But I got the output
rahulmohan: in my computer i tried the same
rahulmohan: it is wrong
Anonymous: Ok then u correct my program and make changes
Answered by chandanapnaidu
2
import java.util.*;
public class sample
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
System.out.println("enter ur name");
String a=in.nextLine();
System.out.println("enter ur age");
int b=in.nextInt();
}
}

Similar questions