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




Have Programming Question? Ask it here!
 
 
 


Suresh Shahapurkar
java 17
1 Answer(s)      3 years ago
Posted in : Java Beginners


Write a java program to accept different types of inputs in a line at time from the keyboard(like name,age,salary,gender) just like one can do using scanf() in c (using String tokenizer).


Advertisement
View Answers

August 23, 2011 at 4:14 PM


import java.io.*;
import java.util.*;
 class InputValues{   
   public static void main( String [] args )throws Exception{
       BufferedReader br = new BufferedReader( new InputStreamReader(System.in));
       System.out.println("Enter string that contains name, age, salary and gender separated by comma(,): ");
       String input = br.readLine();
       StringTokenizer st = new StringTokenizer(input, ",");
       String name=st.nextToken();
       int age=Integer.parseInt(st.nextToken());
       int salary=Integer.parseInt(st.nextToken());
       String gender=st.nextToken();
        System.out.println();
       System.out.println("Name: "+name);
       System.out.println("Age: "+age);
       System.out.println("Salary: "+salary);
       System.out.println("Gender: "+gender);
   }
 }


Related Tutorials/Questions & Answers:
java 17
java 17  Write a java program to accept different types of inputs in a line at time from the keyboard(like name,age,salary,gender) just like one can do using scanf() in c (using String tokenizer
CSS get variables finally after 17 years
CSS get variables finally after 17 years - Now use variables in CSS document In this tutorial you will know about the CSS and how it has become possible... concept with the same and now after 17 years, one can put variables
Advertisements
java run time error - Java Beginners
java run time error  i am getting error "main... :SGM :TP INDEL4 2 28 12:41 0 23 08:17 0 23 08:17 2 28 12:52 0 23 08:17 0 23 08:17 INPPG6 0 23 08:17 0 23 08:17 0 23 08:17 0 23 08:17 0
take variables in text file and run in java
take variables in text file and run in java  I have a text file which have variables 17 10 23 39 13 33 How to take "17"in java code
java patern - Java Beginners
java patern  write a program to print the given pattern? 1 10 11 20 2 9 12 19 3 8 13 18 4 7 14 17 5 6 15 16
java comparison
java comparison   TABLE 1 TABLE 2 column 1column 2column 3... 17 25 C 4 15 F 19 17 A 5 17 A 33 17 B 6 17 B 1 17 K 7 25 D 7 33 K 8...) on excel line 12, likewise Table 1 is not having (17 & K) on excel line 8. i need
java
java   i have a csv file with more than 20 column.its an airport data .i have to read this file and also i have to calculate % delay if flight... timing in column 14 and destination name is in 17 column
java
. for example 197mintes becomes 3 hours ad 17 minutes save the program as time java...java  3.write an algorithem and the java program that declars aminutes variable that represents minutes worked on ajob and reads avalue using Dialog
java patern - Java Beginners
java patern  write a program to print the given pattern? 1 10 11 20 2 9 12 19 3 8 13 18 4 7 14 17 5 6 15 16   Hi Friend, Try the following code: import java.io.*; class Plus{ public static void main
java string multiplication
java string multiplication  Is there any simple method of string multiplication in java ..?   public class StringMultiplication { public static void main(String[] args) { String number1 = "17"; String number2
java bits 5 - Java Interview Questions
java bits 5  Given: 10. interface Foo {} 11. class Alpha implements Foo { } 12. class Beta extends Alpha {} 13. class Delta extends Beta { 14.... // insert code here 17. } 18. } Which code, inserted at line 16, will cause
Java Problem - Java Beginners
Java Problem  Write a program 2 input a positive integer n and check wheter n is prime or not and also know the position of that number in the prime series i.e. 2 3 5 7 11 13 17....... For eg. ---> if input is 11
mysql-java
mysql-java   i try to execute this code stmt1.executeUpdate("insert... near '://www.publishersweekly.com/pw/by-topic/authors/index.html','Fri, 17 May...) at Mydb.main(Mydb.java:111) Java Result: 1 please help me to find the error  
java
java  diff bt core java and java
java
java  what is java
java 2d arrays
java 2d arrays  Create a program that will: a) Create the array and populate it with the given values. 9, 8 2, 17 49, 4 13, 119 2, 19 11, 47 3, 73 b) Multiply, for each row, the value of the first column by the value
JAVA
JAVA  how the name came for java language as "JAVA
java
java   why iterator in java if we for loop
java
java  explain technologies are used in java now days and structure java
java
java  different between java & core java
Java
Java   Whether Java is pure object oriented Language
java
java  is java open source
java
java  what is java reflection
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java - Java Beginners
hope u will reply me soon for this question also. Q)HOw to convert below program into java actually the code is in c++.Please send me the converted code.i... int main() 14 { 15 mmid pairs; 16 17 cout <<
Kerala with South India Tour
- Kochi Tour Package Duration: 16 Nights / 17 Days Day 01: Arrival... community. Dinner and overnight at resort at Marari. Day 17: Kochi
java
java   What is ?static? keyword
java
java  RARP implementation using java socket
java
java  sample code for RARP using java
java
java  Does java allows multiline comments
Java
Java  how to do java in command prompt
java
java  give a simple example for inheritance in java
java
java  give a simple example for inheritance in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  Write a java code to print "ABABBABCABABBA
java
java  write a program in java to acess the email
java
java  send me java interview questions
java
java  how use java method
java
java  what are JAVA applications development tools
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  is java purely object oriented language
java
java  why multiple inheritance is not possible in java
java
java  explain object oriented concept in java
java
java   difference between class and interface
Java
Java  how to draw class diagrams in java
java
java  write a java program using filenotfoundexception
 

 

 

DMCA.com