Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners help please!!! T_T
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


danjim deleon
help please!!! T_T
1 Answer(s)      2 years and 3 months ago
Posted in : Java Beginners


what is wrong in this?:

import java.io.*; class InputName static InputStreamReader reader= new InputStreamReader(system.in); static BufferedReader input= new BufferedReader (reader); public static void main(String[]args) throws Exception { String name1; String name2;

System.out.println("please enter your name:"); name1= input.readline(); System.out.println("please enter your friend's name:"); name2= input.readline(); System.out.println("name1"+ "name2"+ are+ friends); }


Advertisement
View Answers

August 23, 2012 at 5:08 PM


We have modified your code. Check it.

import java.io.*; 

class InputName{ 

    static InputStreamReader reader = new InputStreamReader(System.in);
    static BufferedReader input = new BufferedReader (reader); 
    public static void main(String[]args) throws Exception {
        String name1;
        String name2;

        System.out.println("please enter your name:");
        name1= input.readLine(); 
        System.out.println("please enter your friend's name:");
        name2= input.readLine();
        System.out.println(name1+" and "+name2+ " are friends");
        }
}


Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com