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



Home Answers Viewqa Java-Beginners StringTokenizer not returning proper result
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Vamsi Sai
StringTokenizer not returning proper result
0 Answer(s)      2 years and 10 months ago
Posted in : Java Beginners


I have this code...

System.out.print("Enter the stack integers side by side with a space in between: ");
StringTokenizer st=new StringTokenizer(br.readLine());
int a[]=new int[9000];
int i=0;
do
{   
    a[i]=Integer.parseInt(st.nextToken());
    i++;
}while(st.hasMoreTokens());

When I print the elements in the array it prints me nothing. I tried to change datatype to String still the problem persists. And when I change the condition in the do...while loop I get only half of the elements given in the input when I print the array.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
StringTokenizer not returning proper result
StringTokenizer not returning proper result  I have this code... System.out.print("Enter the stack integers side by side with a space in between: "); StringTokenizer st=new StringTokenizer(br.readLine()); int a[]=new int[9000
Java stringtokenizer
Java stringtokenizer  What is difference between string and stringtokenizer
Advertisements
Problems in Stringtokenizer
node[]; StringTokenizer str,str1; Input() throws Exception { FileReader df=new FileReader("Input.txt"); Scanner fr=new Scanner(df); str=new StringTokenizer... StringTokenizer(fr.nextLine(),"$"); System.out.println("rtryutrty"+n+vn); for(int i
Problems in Stringtokenizer
node[]; StringTokenizer str,str1; Input() throws Exception { FileReader df=new FileReader("Input.txt"); Scanner fr=new Scanner(df); str=new StringTokenizer... StringTokenizer(fr.nextLine(),"$"); System.out.println("rtryutrty"+n+vn); for(int i
Problems in Stringtokenizer
node[]; StringTokenizer str,str1; Input() throws Exception { FileReader df=new FileReader("Input.txt"); Scanner fr=new Scanner(df); str=new StringTokenizer... StringTokenizer(fr.nextLine(),"$"); System.out.println("rtryutrty"+n+vn); for(int i
Query on StringTokenizer
Query on StringTokenizer   Sir,I kept my some data in backend using ms-access. for Example my data is like this vijayawada is good city.india is my country.i am raja. when i retrieve this data from backend and keep
program using StringTokenizer
program using StringTokenizer  I want to know about StringTokenizer,so can you please explain it with an example
how to use stringtokenizer on table? and display in table format.
display result in row format  how to use stringtokenizer on table? and display in table format
returning a value from Threads
returning a value from Threads  Hello I have worker pattern that uses ExecutorService to schedule Thread execution but getting stuck at some point when returning a value using Future.I have code snippet below: ExecutorService
Can iadd StringTokenizer into JLabel componenet
Can iadd StringTokenizer into JLabel componenet  l24="india.cricket.java.dotnet.oracle" String mn=l24; StringTokenizer mn1=new StringTokenizer(l24...(3,280,1580,600); nowon.setBackground(Color.cyan); sir i want to add StringTokenizer
Date not getting in proper format
Date not getting in proper format  import java.util.*; class Date { public static void main(String[]args) { Date d = new Date(100000000000L); System.out.print("1st date"+d.toString()); } } out put:- 1st date@3e25
returning doubles with 2 decimals JAVA
returning doubles with 2 decimals JAVA  Hi all. I'm writing a program where users input the cost of an item (in the constructor), so for example, Item (string name, double cost, int qty) { ... } I have a method public double
result problem
result problem  sir,i have written program given below but that program is not giving proper output.pls help me import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; class filedata extends
how to use stringtokenizer on table? and display in table format.
how to use stringtokenizer on table? and display in table format.  table is retrieved from mysql database and each row contains data like(java,c,c++,.net
method returning null on JSP page.Plz HELP!!!
method returning null on JSP page.Plz HELP!!!  public String getServerAddress(String sName,int sPort,String pKey) { String... it is returning null while the parameter values are successfully passed.while I am
method returning null on JSP page.Plz HELP!!!
method returning null on JSP page.Plz HELP!!!  public String getServerAddress(String sName,int sPort,String pKey) { String... on the jsp page it is returning null while the parameter values are successfully
display result
display result  i want a code that takes input from user through dropdown box and display the result into table.all the values regarding the user input must be displayed. i am using mysql database   hi i want study
Breaking a string into words without using StringTokenizer
Breaking a string into words without using StringTokenizer  how can we Break a string into words without using StringTokenizer ??   The given code convert the string into words. import java.util.*; class StringExample
why above code returning the value of squares is 82... even after returning an increnented value of squares... please help me...
why above code returning the value of squares is 82... even after returning an increnented value of squares... please help me...   public class d55 { int squares = 81; public static void main(String
how to make a proper arrangement of a string - JSP-Servlet
how to make a proper arrangement of a string  Dear sir, I have a string matter that is stored in a arraylist .I amgetting that string from... .Thanks Hr. so now i want to send a matter with a proper manner i.e following
What's the proper way to test a class with private methods using JUnit?
What's the proper way to test a class with private methods using JUnit?  What's the proper way to test a class with private methods using JUnit
result after compilation
result after compilation  public class MainCls { public static void main(String argv) { System.out.println("My text
how to append data to XML file in proper format using JSP
how to append data to XML file in proper format using JSP  hello i... not getting XML file in proper format as XML rules.lease help me to get XML file in proper format.I am using Jdeveloper. My code: <%@page import="java.io.
Result=Set - Java Beginners
Result=Set  Hi Friend, Can u tell how to get the count of records. in a select operation like sqlstmt="SELECT * FROM search_log_tab WHERE... result set, first move the pointer from first record to last record and get
Sort Result set
Sort Result set   I build a connect for my page with the database and then read all rows and show it in a table, I want to change the view of my data to be sorted uppon a specific column when click on the column name, so what
result analysis issue
result analysis issue  i have given 100 users in my thread group for http sampler.some threads r getting response and some threads r getting error response.the error response shown in view results tree listener is as shown below
write the result into excelsheet
write the result into excelsheet  package reader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import... the result in to the same excel file....... please help me. if username is superadmin
hide and show result in jsp
hide and show result in jsp  what codes do i have to change to make my result display if only i enter the correct value? suppose if i click search,then the result will be display at the bottom.. if not.. only the header
what is proper way to save pictures in SQl database and call it through JSP ?
what is proper way to save pictures in SQl database and call it through JSP... type i can't see text on same page. Please tell me proper way to do this, and Please send me a proper programe code regarding this segment(If possible). Please
getting result in table dynamically - Struts
getting result in table dynamically  How do i get result in tabular format dynamically using our own tags
Result interface in Struts 2.2.1
Result interface in Struts 2.2.1 Struts Result interface is a public interface of package com.opensymphony.xwork2. It extends Serializable interface. All the known classes such as PlainTextResult, ServletRedirectResult, 
Advertisements
 

 

 

DMCA.com