Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Java Programming Code Examples

Java > Core Java Code Examples

Core java programmer

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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
Core java programmer import java.io.*; import java.sql.*; import java.awt.event.*; import java.awt.*; import java.util.*; import java.lang.*; class History { public static void main(String args[]) { String dd="asbdjs"; while(dd.length()>0) { try{ System.out.println("welcome to personal account information"); System.out.println("\n"+"enter q to quit"); System.out.println("\n"); System.out.println("enter account number :"); BufferedReader read=new BufferedReader(new InputStreamReader(System.in)); String sx=read.readLine(); if(sx.equals("q")) { System.exit(0); } else { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException k) { System.out.println(k); } try { String url="jdbc:odbc:test"; int account=Integer.parseInt(sx); String command="select * from Account where account like "+account; Connection con=DriverManager.getConnection(url); Statement s=con.createStatement(); ResultSet rs=s.executeQuery(command); while(rs.next()) { String s1=rs.getString(1); String s2=rs.getString(2); int d1=rs.getInt(3); int d2=rs.getInt(4); int s3=rs.getInt(5); String data="account "+s1+"\n"+"date "+s2+" withdrawl "+d1+" deposit "+d2+"\n"+"balance "+s3+"\n"; System.out.println(data); System.out.println("\n"); } } catch(SQLException k) { System.out.println(k); } } } catch(Exception w) { System.out.println(w); } } } }