Monday, 15 August 2016

Java Programme - Bluej Environment

* Write a Programme to take input your name, Print your name.
Ans- inport java.util.*;
          public class Name
          {
          public static void main ( String args [ ] )
          {
           Scanner sc = new Scanner ( System.in);
          System.out.println (“Enter your name");
String a = sc.nextLine( );
           System.out.println (“My name is " + a);
       }
       }
* Write a programme to take input your address and marks of two subjects. Display everything.
Ans-
inport java.util.*;
public class Address
{
public static void main ( String rgs [ ])
{
Scanner sc = new Scanner ( System.in);
System.out.println ( “Enter your address");
String a = sc.nextLine( );
System.out.println ( “My address is " + a);
System.out.println (“Enter your marks of two subjects ");
int m = sc.nextInt( );
System.out.println (“My marks of two subjects is " + m);
}
}
            

No comments:

Post a Comment

Note: only a member of this blog may post a comment.