Suresh Shahapurkar
java 17
1 Answer(s)      a year and 9 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.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 Pages:
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
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 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
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
. 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 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
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   Hi Friend, Try the following code: import java.io.*; class Plus{ public static void main
help in java
help in java  Write a program that will evaluate simple expressions such as 17 + 3 and 3.14159 * 4.7. The expressions are to be typed in by the user. The input always consist of a number, followed by an operator, followed
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
Hiiii - Java Beginners
Hiiii  Hi friend, when i am input all fiesls are manually then give the message parameter index out of range <18> <17> please tell me what is the error and where is incorrect in my code Thanks
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 - Java Beginners
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 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
patterns printing using for loop in java
patterns printing using for loop in java  how to write the code for the pattern as: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
java - Java Beginners
', '00:00:00', '', '', ''), ('0000-00-00', '03:33:17', '00:00:00', '', '', ''), ('2010-04-24', '03:34:17', '00:00:00', '', '', ''), ('2010-04-11', '05:12:15
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 Debugger,Java Debuggers
Java Debugger       Java debugger helps in finding and the fixing of bugs in Java language programs. The Java debugger is denoted as jdb. It works like a command-line
java - Java Interview Questions
the command line as: java MyProg I like tests what would be the value of args[ 1... until a value is assigned 3. Which of the following are Java keywords... statements assigns "Hello Java" to the String variable s? a) String s
wbdb.sql - Java Beginners
'), (9, 17, '_wp_trash_meta_status', '1'), (10, 17, '_wp_trash_meta_time...)', 'john@churchcrunch.com', 'http://churchcrunch.com', '207.255.235.40', '2008-09-17 17:16:35...', '2008-09-17 17:14:05', '2008-09-17 22:14:05', 'Howdy! This is an admin comment.', 0, '1
How to insert new line after every space in java
How to insert new line after every space in java  Hii Sir, I have a string with values 69 17 17 16 2 1 1 26 26 56 like this .Now as per my need i have to put all these values into new lines on getting space
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 Calculator program - Java Beginners
Java Calculator program  import java.awt.*; import javax.swing.... the above program gives 15 but I would like to see 17 and the subtract 2 from...://www.roseindia.net/java/example/java/swing/calculator-in-swing.shtml Hope
convert to java plss - Java Beginners
convert to java plss  hi i am using microsoft VB6.0 and my friend ask me to make java program to convert number to words but i only use visual basic because i dont know much in java plss convert it to me this is my code
programs - Java Beginners
. 16. Write a Java program to Demonstrate methods of Tree Set class. 17.... (by using methods of minimum and maximum of numbers) 3. Write a Java program to demonstrate inheritance. 4. Write a Java program to demonstrate dynamic
programs - Java Beginners
. 16. Write a Java program to Demonstrate methods of Tree Set class. 17.... (by using methods of minimum and maximum of numbers) 3. Write a Java program to demonstrate inheritance. 4. Write a Java program to demonstrate dynamic
java code - XML
java code   i have to store this file into database i know normal xml storing ...but how to proceed through nested elements and attributes i dont... India FilmKraft India 500 million 2010 17 may   
write a program in java.
write a program in java.  arrange the natural n umber in 5x5 matrix as 21 22 23 24 25 20 7 8 9 10 19 6 1 2 11 18 5 4 3 12 17 16 15 14 13 i at centerd position and remaining arrange in anticlockwise direction.  
java coding help plz ?
java coding help plz ?  Given two integers N and M (N ΓΆβ?°Β¤ M), output all the prime numbers between N and M inclusive, one per line. N and M... Output 5 7 11 13 17 19   import java.util.*; class FindPrime
Java: Basic GUI
Java NotesBasic GUI Next - Big Blob This first example just shows what... 16 17 18 // structure/CalcV1.java // Fred Swartz - December 2004 // GUI... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Java Multi Dimensions Array - Java Tutorials
.style1 { text-align: center; } Multidimensional Arrays in Java In java, the grouping of same type of elements for storing under the same name...(element); } } } Output : C:\Program Files\Java\jdk1.6.0_18\bin>
Java: Rainfall Model
Java NotesRainfall Model 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
Array in JOptionPane - Java Beginners
this: 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17
javascipt - Java Beginners
"; stocks.size=17; stocks.name="stocks
Java Mail API - JavaMail
Java Mail API  Hi! I wish u advanced happy new year to all of ur... account using java mail api... i got code from our roseindia.net i.e....) ... 17 more Caused
java validations
java validations  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01...; <option value="17">17</option> <...; <option value="17">17</option> <
Java Programmers aren't Born,java newsletter,java,tutorial
be programming in Java. And what about the time from 17:30 (when you get... Java Programmers aren't Born 2004-11-30 The Java Specialists' Newsletter [Issue 100] - Java Programmers aren't Born Author: Dr. Heinz M. Kabutz
Console Input-Output (Java 5)
Java NotesConsole Input-Output (Java 5) Java 5's java.util.Scanner class has simplified console I0. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 // File
java script - Struts
java script  how validation for date is performed in the top-down select.if the user clicks submit without selecting the date, month and year. what... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Java: HandyPerson Example
Java: HandyPerson Example 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Java interview questions
Java interview questions  Plz answer the following questions..... The type long can be used to store values in the following range: a. -263 to 263... of the expression a % b when a and b are of type int and their values are a = -17 and b
Kerala Backwaters Tour Package
- Chennai. Tour Package Duration: 16 Nights / 17 Days Day 01... of the day return to the hotel for dinner and overnight. Day 17- Departure
Java: Spiral Traverse
Java: Spiral Traverse This section explain the logic of spiral traverse of n*m matrix in java. Spiral Traverse : Spiral Traverse means move in clock wise..., 12 }, { 13, 14, 15, 16, 17, 18 }, { 19, 20, 21, 22, 23, 24
Java: Method Exercises 4
Java: Method Exercises 4 Name: _________________________________ What is the output from this program... 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Computers - Java Beginners
Computers  Write a Java application to implement a simple...); fr.add(key[16]); //power key[17] = new Button("x^n"); key[17].addActionListener(this); key[17].setBounds(150,150,BWIDTH
On HTML and JavaScript - Java Beginners
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
javascript - Java Beginners
"; stocks.size=17; stocks.name="stocks
Hiiii - Java Beginners
Hiiii   Hi, this is the java file and below describe the .jsp file but i m insert all field manually then give the error parameter index out...); pstmt.setString(16, web_site); pstmt.setString(17, email
Java: Example - ToUppercase
Java: Example - ToUppercase Level Introductory Structure Separate main and GUI files. ComponentsJButton, JTextField ContainersJFrame... 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.