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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Fathi
additinal info
1 Answer(s)      5 years and 3 months ago
Posted in : JSP-Interview Questions



Advertisement
View Answers

September 19, 2009 at 5:30 PM


Hi Friend,

You can use ArrayList class and Iterator interface to extract the data.

import java.io.*;
import java.sql.*;
import java.util.*;

public class GetData{
public static void main(String[]args){
try{
FileInputStream fstream = new FileInputStream("F11633.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
ArrayList list=new ArrayList();
while ((strLine = br.readLine()) != null){
list.add(strLine);
}
Iterator itr;
for (itr=list.iterator(); itr.hasNext(); ){
String str=itr.next().toString();
String [] splitSt =str.split(" ");
String id="",grade="";
for (int i = 0 ; i < splitSt.length ; i++) {
id=splitSt[0];
grade=splitSt[1];
}
System.out.println(id +" "+grade);
}
}
catch(Exception e){}
}
}
Now you can use the variable id and grade for your purpose.

Thanks


Related Tutorials/Questions & Answers:
additinal info - JSP-Interview Questions
additinal info  Dear, Just i want to add some information. I have one txt file. This is its content of F11633.txt: 200809173 86 200772653 90 200807059 92 200806993 90 200804497 null 200803879 null
info button iphone example
info button iphone example  I'm looking for a simple info button example in iPhone XCode. Thanks
Advertisements
Vendor Info Error - WebSevices
Vendor Info Error  Hi, i wrote the code for Vendor Information using java script. If its full time the vendor info alert box is not displayed. And its contract or contract to hire the alert box is displayed. Tell me
Java to extract info to HTML
Java to extract info to HTML  I need to write a java program that will extract information (events) from .ics files, such as those used in iCalendar, into HTML format. I started by creating string instance variables for each
The info Attribute of page Directive In JSP
The info Attribute of page Directive In JSP  ... about the info attribute of the page directive in JSP. This attribute simply... is the JSP code: <%@page info="This is the example of info attribute
Page Directive attribute - info
Page Directive attribute - info This tutorial  contains description of info attribute of page Directive. info Attribute : info attribute of page...;Servlet.getServletInfo()" method. Syntax : <%@ page info="This text contain info
retrieving info from DB using struts?
retrieving info from DB using struts?  Hi. I was looking info about retrieving info from a database using struts. I need a .java that I suppose connects to a database and show the info on a jsp. Somebody could help me
date_sun_info
  date_sun_info() Function of PHP date_sun_info function returns... on success or False on failure.  Description on PHP date_sun_info() Function array date_sun_info ( int $time , float $latitude , float $longitude
The info Attribute of page Directive In JSP
The info Attribute of page Directive In JSP  ... about the info attribute of the page directive in JSP. This attribute simply... is the JSP code:   <%@page info="This is the example of info
Java to extract info from .iCalendar files
Java to extract info from .iCalendar files  I need to write a java program that will extract information (events) from .ics files, such as those used in iCalendar, into HTML format. I started by creating string instance variables
get info from mysql using jsp and servlet
get info from mysql using jsp and servlet  HELLO! I wanna create a jsp page which able to let me get its name, phone and other info by asking the user to key in their email address from mysql database by using servlet and jsp too
how to get harddisk info using S.M.A.R.T using java
how to get harddisk info using S.M.A.R.T using java   how to get harddisk info using S.M.A.R.T using java
The "isThreadSafe" & "info" Attribute of JSP page directive
;info "attribute of JSP page directive. The "isThreadSafe"...;isThreadSafe" page directive is :      <%@page info="text" %>     Example : <%@page info="
Query for gathering info from 3 tables with condition depended on 4th table
Query for gathering info from 3 tables with condition depended on 4th table  I have 4 tables, 1 User profile (PK usrid), 2 Friend list(pk ugid), 3 user updates(PK updatesguid), 4 comments on updates(PK comment guid) i want
Retrieve hardware info of a PC using servlet - JSP-Servlet
Retrieve hardware info of a PC using servlet  Hi,I hav a query related to java servlets.I wanted to know how to retrieve the hardware information using java servlets?I had gone through this link http://www.roseindia.net/software
how to return to main menu after adding all the info. - Java Beginners
how to return to main menu after adding all the info.  import java.util.Scanner; public class RegistrationSystem { public static void main(String[]args){ Scanner scan = new Scanner(System.in); int menu = 0
Use of BasicConfigurator in Log4j logging
log4j warn debug info, that means you have not initialized log4j properly. So
Console Appender in Log4j
on the console each and every time when any info(), debug(), error() method is invoked
Create a Custom Log Level in Java
some levels like: INFO, WARNING, SEVERE, FINEST etc. See brief information about
Maven Web Application: Creating web application in Maven 3
-DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1
Maven Project Build fails - Maven
\domain>mvn clean install -Dmaven.hibernate.skip=true -Dmaven.test.skip=true [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building enactDomain [INFO] task-segment
Hibernate delete a row error - Hibernate
()); } } } ======================================================== The output: 10:46:41,397 INFO Environment:456 - Hibernate 3.0rc1 10:46:41,397 INFO Environment:469 - hibernate.properties not found 10:46:41,397 INFO Environment:502 - using CGLIB reflection optimizer
how to retrive the particular data from database in php with mysql?
_sample where Name='$Name'"); /*$info=mysql_fetch_array($data);*/ while($info=mysql_fetch_array($data)) { echo"<b>NAME</b>:".$info['Name']."<br><b>KEYSKILLS</b>:".$info['Keyskills']."<br><b>
ServletFileUpload request getInputStream - JSP-Servlet
(); } } Here is my console output. 10:03:29,390 INFO [STDOUT] Multipart data -----------------------------7d85d1d7027c 10:03:29,390 INFO [STDOUT] Multipart data...\Phrase1.txt" 10:03:29,390 INFO [STDOUT] Multipart data Content-Type: text/plain 10:03
learn
learn  i need info about where i type the java's applet and awt programs,and how to compile and run them.please give me answer
Frameworks and example source for writing a JDBC driver.
Frameworks and example source for writing a JDBC driver.  Where can I find info, frameworks and example source for writing a JDBC driver
Advertisements
 

 

 

DMCA.com