Amit Barot

Greenhorn
+ Follow
since May 29, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Amit Barot

Statements 1,3 and 4 will only throw the NullPointerException
I also think that only two are creted others are a copy and refer to the same memory address
if u get some more comments then inform me.
amitbarot@usa.net
thankx in advance

Hello
Not a null pointer exception because we have favouritepizza to pizzatobebaked so we are just creating a copy of reference we are not changing the state of the actual object so favouritepizza is not a null.
i hope u get my point .
Sam u can only declare int or data type once in a for loop so
remove int twice from your loop and thats it>
IATA ?
International Air Travel Agent?
Hi again
C its a rule in java that whenever u instantiate a class
Its default cosntructor is called automatically.
And provided that if it extends some class then automaticaaly
the first line executes is super() that is the call to the default constructor of the super class in this case it is A
and after that it is chained by this.
Hope u get it now
If u hav any more problems then feel free to ask me
Hi
i think u are reffering Java Certification book by Khalid Mughal

Whenever u instantiate a class the its default constructor is implicitly invoked in this case class B extends A so by rule
the default constructor of A will also be invoked implicitly
the default constructor call other constructor this("1","2")
and that constructor in turn call other constructor after that the flow returns in the reverse order ie from the Superclass to the subclass and ultimately to the class B where it gets printed
hope this solves your dilemma.
bye cya
hi shuaib
why dont u try the sun's site for finding a list of
compatible drivers
hope u find one
bye.
package jdbcpackage;
import java.sql.*;
public class DataFormating{
static ResultSetMetaData metadata;
static int columnCount;
// Format any ResultSet with this methods //
// ResultSet st is the ResultSet object in your class,RSMD is the RSMD object in your class
// int num is the numbers of columns in your ResultSet.
publicstatic void formatData(ResultSet st,ResultSetMetaData rsmd)throws SQLException{
metadata = rsmd;
columnCount = rsmd.getColumnCount();
for(int columns=1;columns<=columnCount;columns++){
String rowData = st.getString(columns);
String title = rsmd.getColumnName(columns);
System.out.print(rowData);
int j = 0;
while(j<((title.length())-(rowData.length())+20)){
System.out.print(" ");
j++;
}
}
System.out.println();
}
// Format any ResultSet with this methods //
// ResutlSetMetaData is the RSMD object in your class.
// int num is the numbers of columns in your ResultSet.
// For parting the Title from the Data columns.
publicstaticvoid formatTitle(ResultSetMetaData rsmd)throws SQLException{
columnCount = rsmd.getColumnCount();
for(int columns=1;columns<=columnCount;columns++){
System.out.print(rsmd.getColumnName(columns));
int j = 0;
while(j<20){
System.out.print(" ");
j++;
}
}System.out.println();
int k=0;
while(k<=getNameLength(rsmd)){
System.out.print( "-");
k++;
}
System.out.println();
}
public static int getNameLength(ResultSetMetaData rsmd) throws SQLException{
int len=0;
for(int i = 0;i<rsmd.getColumnCount();i++){>
len += rsmd.getColumnName(i+1).length();
}
return (len+((rsmd.getColumnCount()-1)*20))-1;
}
}
/*
eg: How to use this program
Resultset_object = Statement_object.createStatement();
Resultset_object = statement.executeQuery("select * from emp_table");
DataFormating.formatTitle(ResultSet set);
DataFormating.formatData(ResultSet set,ResultSetMetaData rsmd);
*/
Hope u get it and use it try it seriously it is a very good program and let me know how u find it.
hi again i just found out the GENERAL ERROR usually comes when u insert duplicate entries in the primary field in the database
ok hope this will solve your problem bye and let me know what if u make it thru
bye .
According to your description the problem seems to be blank fields in the database that is the primary key might be blank so try to fill in that key in all the records or delete that row and then try
if this fixes your problem then its well and good
try solving my problem!
Hello guys
i m in bit of trouble i have an application,but dont exactly know how to make an exe out of that application so that i dont have to run java to run my program
if anyone of u hav any idea the please let me know & its urgent!!
Thanx in advance!
Yes u can insert into the MS ACCESSS 2000
pass the string into the
statement.executeQuery("insert into <table Name>(<field1,field2) values('String','String',Integer)>
look the followwing thing is a new thing which i found out
if u hav some value assinged to a variable like
String name = "amit";
and if u want to insert that variable then the syntax in the VALUES will be values('"+name+'",'"+name2+"')otherwise u will get an SQLException java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
ok then this might solve your query
bye.