Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Emily Diaz   on Nov 12 In Java Category.

  
Question Answered By: Bonnie Hughes   on Nov 12

you can use the command
String filename = "test.txt";
File f = new File(filename);
f.copy("dest.txt");
and so on
There is directory  command as well by which you can read  all the file
exact sentence i do not remembering

directory d = new directory(c:\k2");
Enumeration enum = d.Elements();
and so on

(ii) for deletion of space  use
String s1 = "hello ";
s1 = s1.trim();

(iii) use simple jdbc command for this
import java.util.*;
import java.sql.*;
public class  data2 {
public static void main(String argv[])
{
String str1,str2,str3;
Statement s1;
Connection con;
ResultSet rs,rs2;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("Jdbc:Odbc:jemp"); //jemp is the odbc name
s1 = con.createStatement();
str1 = "select * from emp";
// rs2 = "insert into emp2 where name =" ' " + str1" and " '"code = &str2"
rs = s1.executeQuery(str1);
while(rs.next())
{
str2 = rs.getString("name");
str3 = rs.getString("code");
System.out.println("Name :"+str2+ " Code: "+str3);
}
}catch(Exception e) {}
}
}

iv) for the fourth try to do work on command prompt.
The only criteria is class called should be in the same directory.
see if you have already compiled the java  file that you are calling

Share: