krishan
give the code for this ques///
1 Answer(s)      6 years and a month ago
Posted in : Java Beginners

write a program in java in which there is a clss readline. the functionality of this class is to read a string from the console and display it on the console .A point that should be keep in mind is that ,your program must get and after displaying the string of inputted . you can use some symbol/character as a terminator///

Ads

View Answers

December 7, 2010 at 4:27 PM


Hi Friend,

Try the following code:

import java.util.*;
class ReadLine{
    public static String read()
    {
        String st = "";
        Scanner input=new Scanner(System.in);
            st = input.nextLine();
        return st;
    }
    public static void main(String[] args){
        System.out.print("Enter Name: ");
        String name=read();
        System.out.println("Hello "+name+"!");
            }
}

Thanks










Related Tutorials/Questions & Answers:
give the code for this ques///
give the code for this ques///  write a program in java in which there is a clss readline. the functionality of this class is to read a string from... the following code: import java.util.*; class ReadLine{ public static String
give the code for this ques///
give the code for this ques///  write a program in java which contains a class simple. this class contains 4 members variables namely a,b,c,and d...//   Hi Friend, Try the following code: class Simple{ int a,b,c,d
Advertisements
Ques
Ques  plz plz give coding for C CO COM COMP COMPU COMPUT COMPUTE...; Hi Friend, 1)Try the following code: import java.util.*; class...   Hi FRiend, 2)Try the following code: import java.util.*; class
give the code for servlets session
give the code for servlets session  k give the code of total sample examples of servlet session
huffman code give the explanation for this code
huffman code give the explanation for this code  package bitcompress...); } value = 0; bit_count = 0; } } else { int code; bit_array[bit_count++] = bit; if ((code = huffcode_find (bit_array
huffman code give the explanation for this code
huffman code give the explanation for this code  package bitcompress...); } value = 0; bit_count = 0; } } else { int code; bit_array[bit_count++] = bit; if ((code = huffcode_find (bit_array
Plz give me code for this question
Plz give me code for this question  Program to find depth of the file in a directory and list all files those are having more number of parent directories
Give me the source code for this problem
Give me the source code for this problem  Ram likes skiing a lot. That's not very surprising, since skiing is really great. The problem with skiing is one have to slide downwards to gain speed. Also when reached the bottom most
verify the code and give me the code with out errors
verify the code and give me the code with out errors   import java.awt.*; import java.awt.event.*; import javax.swing.border.Border; import... clear the errors and give me correct tutorial for my knowledge improving.pls anyone
please help me to give code - Java Beginners
please help me to give code  Write a function with a signature cheerlead(word) that prints a typical cheer as follows. The word robot: Gimme an R Gimme an O Gimme a B Gimme an O Gimme a T What did you give me? ROBOT
provide me the program for that ques.
provide me the program for that ques.  wtite a program in java there is a class readchar.the functionality of this class is to read a string from...;Hi Friend, You can try the following code: import java.util.*; class
please help me to give code - Java Beginners
please help me to give code  Write a function, sliding(word, num)that behaves as follows. It should print out each slice of the original word having length num, aligned vertically as shown below. A call to sliding(examples, 4
please help me to give code - Java Beginners
please help me to give code  Write a program that uses loops to generate an n x n times table. The program should get n from the user. As a model here is a 4 x4 version: | 1 2 3 4
please help me to give code - Java Beginners
please help me to give code  Write a program that prints an n-level stair case made of text. The user should choose the text character and the number of stairs in the stair case * ** *** ****   Hi friend
please help me to give code - Java Beginners
please help me to give code  Write a program that reads a file named famous.txt and prints out the line with the longest length. In the case of a tie, you may print out only one of them. For example in the file: Alan Turing
can any one give the frogort password code using jsp,
can any one give the frogort password code using jsp,  plz give the code for frogot password
how to send email please give me details with code in jsp,servlet
how to send email please give me details with code in jsp,servlet  how to send email please give me details with code in jsp,servlet
give me source code of webpage creation using html
give me source code of webpage creation using html  how to create a webpage using html
i have an ques. of advanced java
i have an ques. of advanced java  write a wap to implement AWT by login form
Pleae help me to give logic and code for this program - Java Beginners
Pleae help me to give logic and code for this program  Write a function that given the string ?original? create a new string ?dramatic? that has two consecutive copies of each letter from the original string. For example
Please give me the code for the below problem - Java Interview Questions
Please give me the code for the below problem  PROBLEM : SALES TAXES Basic sales tax is applicable at a rate of 10% on all goods, except books... Vidya  Hi Friend, Try the following code: import java.util.
about interview ques. - Java Interview Questions
about interview ques.  i give a interview for java.. they ask me. what is System.out.println(); what is its write ans...  Hi Friend, It is the syntax of Java used to display a string on the console window
give answer
give answer  . Which of the following will he use to compile the KeyTest class successfully
plz. answer my ques - Java Beginners
into `user` (`user`, `password`) values('amit','kumar'); Code for validating
give idea
give idea  how to plot graph in java   Please visit the following link: http://www.roseindia.net/java/example/java/swing/draw-simple-bar-chart.shtml
give me a grid example in php
give me a grid example in php  give me easy code example of grid in php like mysql editor
HTML Color Code for purple
HTML Color Code for purple In this page you will find the hexadecimal color code for Purple color. The hexadecimal color code for dark purple is #800080... is the color code of both type of Purple color. Color Name Color code
give information or website address
give information or website address  hi i want u r help .... i m finding code for constructing graph in java but during execting them i have problem bec of packages... has i proceed i came to know