Share on Google+Share on Google+

Suresh Shahapurkar
java 17
1 Answer(s)      5 years and 7 months 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).


View Answers

August 23, 2011 at 4:14 PM

import java.util.*;
 class InputValues{   
   public static void main( String [] args )throws Exception{
       BufferedReader br = new BufferedReader( new InputStreamReader(;
       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("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
Exercise 17
Exercise 17  Character Counter Write a program which takes an input string and determines the number of vowels, consonants, digits, and special characters (i.e., all other nonalphanumeric characters) in the string
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
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   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
. for example 197mintes becomes 3 hours ad 17 minutes save the program as time  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*; 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   i try to execute this code stmt1.executeUpdate("insert... near '://','Fri, 17 May...) at Mydb.main( Java Result: 1 please help me to find the error  
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  diff bt core java and 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  what is 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 <<
java  different between java & core java
java  explain technologies are used in java now days and structure java
java   why iterator in java if we for loop
Java   Whether Java is pure object oriented Language
JAVA  how the name came for java language as "JAVA
java  what is java reflection
java  is java open source
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   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java  write a java program using filenotfoundexception
java  is java purely object oriented language
java  how use java method
Java Spring Hibernate Struts Training What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? file location SASLError using PLAIN: not-authorized how to convert war file into .exe file using java code


Advertisement null