Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

additinal info

Ads

 
 

Share on Google+Share on Google+

Fathi
additinal info
1 Answer(s)      7 years ago
Posted in : JSP-Interview Questions
Ads
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

Ads









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: <[email protected] 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:   <[email protected] info="This is the example of info
Version of com.sensatus>sbt-build-info-conf dependency
List of Version of com.sensatus>sbt-build-info-conf dependency
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 :      <[email protected] info="text" %>     Example : <[email protected] info="
Maven Dependency sbt-build-info-conf >> 1.1.0
You should include the dependency code given in this page to add Maven Dependency of com.sensatus >> sbt-build-info-conf version1.1.0 in your project
Maven Dependency sbt-build-info-conf >> 1.0.0
You should include the dependency code given in this page to add Maven Dependency of com.sensatus >> sbt-build-info-conf version1.0.0 in your project
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
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
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
Create a Custom Log Level in Java
some levels like: INFO, WARNING, SEVERE, FINEST etc. See brief information about
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
Maven Web Application: Creating web application in Maven 3
-archetype-webapp -DinteractiveMode=false [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO
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>