a1

a1

read a string from java who contains spaces

View Answers

November 15, 2010 at 4:10 PM

Hi Friend,

Try the following code:

import java.util.*;
public class Input
{
    public static void main(String[]args){
        Scanner input=new Scanner(System.in);
        System.out.println("Enter string: ");
        String st=input.nextLine();
        System.out.println("You have entered: "+st);
    }

}

Thanks









Related Tutorials/Questions & Answers:
a1
a1  read a string from java who contains spaces
Ask about looping in database
| name | | 1 | A1 | BOY | | 2...; | no | code | rule | rights | | 1 | A1 | If A1= False and A2 = True | 1/2 | | 2 | A2 | If A1
Advertisements
SCJP Module-6 Question-28
Given below the sample code : class A1{ public void process() { System.out.print("Inside A1 "); }} class B extends A1{ public void process... is caught "); }}} What will be the output of the above code? 1.Inside A1
Please explain the logic....
Please explain the logic....  class A1 { } class B extends A1... main(String[] args) { A1[] aa = new A1[2]; B[] ba = new B[2...); } static void sifter(A1[]... a2) { s += "1"; } static void sifter(B
javascript:getElementByClassname:Is it possible to collect all the elements with same classname
()? like a a1 now i want to take a and a1 n put in single array. can any1 help me
A regular expression contains another regular expression - PHP
A regular expression contains another regular expression   Please explain how it works in PHP... RegEX1 = "a.*b"; RegEx2 = "a1.*b"; Thanks
java multidimensional array - Java Beginners
[][] = getArr(); int a1,a2,a3,a4; a1 = a.length; a2 = b.length; a3 = a[a1].length; a4 = b[a2].length; if( (a1!=a2) || (a3!=a4) ) { System.out.println
Implement Complex Number Class
) { int a1 = num1.a + num2.a; int b1 = num1.b + num2.b; if (b1 < 0) { return a1 + "" + b1 + "i"; } else { return a1 + "+" + b1 + "i...) { int a1 = num1.a - num2.a; int b1 = num1.b - num2.b; if (b1 < 0
PHP list class methods
($ar1 as $a1) { echo "<br> class--> ".$a1; } ?>ADS_TO_REPLACE_1
SCJP Module-1 Question-26
Given a sample code: abstract class A { abstract void a1(); void a2() { System.out.print(" A"); } } class B extends A { void a1() { } void a2() { System.out.print(" B"); } } class Test extends B
programmes - Java Beginners
){ int a1= num1.a+num2.a; int b1= num1.b+num2.b; if(b1<0){ return a1+""+b1+"i"; } else { return a1+"+"+b1+"i... a1= num1.a-num2.a; int b1= num1.b-num2.b; if(b1<0){ return a1
jav a - Design concepts & design patterns
num2){ int a1= num1.a+num2.a; int b1= num1.b+num2.b; if(b1<0){ return a1+""+b1+"i"; } else { return a1+"+"+b1+"i"; } } public static void main
vector and arraylist
vector and arraylist    suppose i have class A { public static arrylist a1(){} class B{ public static vector b1() {} } my question is how to class B method in Class A and how to get vector object values in class A without
SCJP Module-6 Question-21
Given below the sample code : class Main { static String a = "&&"; public static void main(String[] args) { new Main().a1(); System.out.println(a); } void a1() { try { a2(); } catch (Exception e) { a += "
java Code Problem - Java Beginners
a1,a2,a3,a3,a5; int sum(int a1,int a5) { this.a1=a1; this.a5=a5; return a1+a5
Class and object
Class and object  what is exact meaning for the statement, A a1=new B();   Hi, Here is two classes A and B. A is super class...(); A a1 = new A(); System.out.println(a.i); System.out.println(a1.i
dynamic retrivel of data from mysql database in table format at jsp
... At jsp, if i choose A1 from the dropdown list then the corresponding details of A1 should be retrived from database and display it in the respective textbox
Java programmes - Java Beginners
static String addition(ComplexNumber num1, ComplexNumber num2){ int a1= num1.a+num2.a; int b1= num1.b+num2.b; if(b1<0){ return a1+""+b1+"i"; } else { return a1+"+"+b1+"i"; } } public static String substraction(ComplexNumber num1
SCJP Module-6 Question-29
Given below the sample code : 1   class A1{ 2   public void process() { System.out.print("Inside A1 "); }} 3   class B extends A1{ 4   public void process() throws IOException{ 5 
JAVA - Java Beginners
, ComplexNumber num2){ int a1= num1.a+num2.a; int b1= num1.b+num2.b; if(b1<0){ return a1+""+b1+"i"; } else { return a1+"+"+b1+"i"; } } public static void
Active Objects - Java Beginners
num1, ComplexNumber num2){ int a1= num1.a+num2.a; int b1= num1.b+num2.b; if(b1<0){ return a1+""+b1+"i"; } else { return a1+"+"+b1+"i"; } } public
java - Java Beginners
, ComplexNumber num2){ int a1= num1.a+num2.a; int b1= num1.b+num2.b; if(b1<0){ return a1+""+b1+"i"; } else { return a1+"+"+b1+"i"; } } public static void
DATABASE QUERY
"); res.next(); String a1=res.getString("??????"); String a2=res.getString("??????"); request.setAttribute("a1", a1
SCJP Module-9 Question-18
;Roseindia"); 9.  String a1 = new String("Roseindia"); 10...); hash.add(a1); hash.add(a2); 12. System.out.println(hash.size()); } } What
how to move pointer in Textfield to newline
s1=tf1.getText(); String s2=tf2.getText(); int a1=Integer.parseInt(s1); int...]=a1*i; String s3="",s4="",s5=""; s3=String.valueOf(a1); for(int i=1...(); int a1=Integer.parseInt(s1); int
SCJP Module-4 Question-18
Given the following sample code: public class Example5{ public float Twin(float a, float b) {... } public float Twin(float a1, float b1) { ...} } How can we correct the above code ? 1. By placing overriding method
java
void main(String a1[]) { updateInfo o= new updateInfo(); p.update
how to create interfaces in java
to update information of customer } public static void main(String a1
check
=pass; } public static void main(String a1[]) { updateInfo o= new
non static variable cannot be referenced from static context
public static void main(String []s){ Add a1=new Add(); a1.add(7,8
Excel Cell Drop Down List
into cell A1 is restricted to the following : 10,20,30. The drop down is also provided with cell A1 having possible values i.e. 10,20,30.  If the value entered in A1 is other than this, it will show you error message.ADS
php array difference / php array diff
;  echo "array1 <br>";     foreach ($ar1 as $a1){       echo " ".$a1;     
Compare two char array in java
;System.out.println(Arrays.equals(c1, c2));     char[] a1...;System.out.println(Arrays.equals(a1, a2));   } } Output
Interview Question - Java Interview Questions
;i a1 = Arrays.asList(arr1); List a2 = Arrays.asList(arr2); int... HashSet(); s.addAll(a1); s.addAll(a2); ArrayList list = new ArrayList(); for(int
why java does not support multiple inheritance - Java Beginners
A1,A2,A3 classes have same method identifier but with different parameters class A1 { void show1() { System.out.println("show1() method of class A1
Show Addition, Subtraction, Intersection, Exclusive OR on one frame
) subtract the area of a1 from a2. The a.intersect(a2) shows the common area...;{   a1 = new Area(new Ellipse2D.Double(120, ... = (Graphics2D) graphics;   graphics2D.draw(a1);  
Show Addition, Subtraction, Intersection, Exclusive OR on one Frame
(a2) subtract the area of a1 from a2. The a.intersect(a2) shows the common area...() {   a1 = new Area(new Ellipse2D.Double(120, ... = (Graphics2D) graphics;   graphics2D.draw(a1);  
Excel Prompt User on Focus
HSSFDataValidation(addressList, dvConstraint); // DISPLAY MSG WHEN CELL A1 IS ON FOCUS dataValidation.createPromptBox("Message on Focus", "Cell A1
SCJP Module-4 Question-5
Given the following sample code: public class Example5{ public float Twin(float a, float b) {... } public float Twin(float a1, float b1) { ...} } Is the method overloading correctly used(in the above code) ? Choose correct
SCJP Module-4 Question-6
Given the following sample code: public class Example5{ public float Twin(float a, float b) {... } public float Twin(float a1, float b1) { ...} } How can above code will be corrected without changing the 'method's name
information updations
} public static void main(String a1[]) { updateInfo o= new updateInfo(); p.update
non static variable cannot be referenced from static context
public static void main(String []s){ Add a1=new Add(); a1.add(7,8
Add Complex Numbers Java
(ComplexNumber num1, ComplexNumber num2) { int a1 = num1.a + num2.a; int b1 = num1.b + num2.b; if (b1 < 0) { return a1 + "" + b1 + "i"; } else { return a1 + "+" + b1 + "i"; } } public static void main(String args
Arrange the sentences in alphabetical order of words Java
= "", st2 = "", st3 = "", st4 = ""; String a1[] = s1.split(" "); Arrays.sort(a1); for (int i = 0; i < a1.length; i++) { st1 += a1[i
Excel Data validation
be entered into cell A1 is restricted to the following : 10,20,30. If the value entered in A1 is other than this, it will show you error message. import...) { e.printStackTrace(); } } } OUTPUT If the value entered in the cell A1
java lab programs - Java Beginners
num2){ int a1= num1.a+num2.a; int b1= num1.b+num2.b; if(b1<0){ return a1+""+b1+"i"; } else { return a1+"+"+b1+"i"; } } public static String substraction(ComplexNumber num1, ComplexNumber num2){ int a1= num1.a-num2.a; int b1
Use of <fn:split(String, String)> and <fn:join(String, String)> Tag of JSTL
;/tr> <tr><c:set var="a1" value="${fn:split...; <td><c:out value="${fn:join(a1, ' ')}" /></td> </tr> <tr><c:set var="a1"
Retrieval of Dropdown list
... for eg, let A1,A2,A3,A4 be the values in dropdown.. if i click A1, the corresponding value of A1, list of name corresponding to A1 wil be displayed in another
Display Different Elements from two ArrayLists in Java
array lists a1 and a2 and add some elements to both of them. Then we have created... have created a condition that if the list a1 does not contains the elements...;void main(String[]args){     ArrayList a1 = 
hierarchy UML class diag
(); }; Question A1 Write the implementation codes for Shape class based

Ads