aspose file tools*
The moose likes Beginning Java and the fly likes Doubt in the following code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Doubt in the following code" Watch "Doubt in the following code" New topic
Author

Doubt in the following code

ChakraPani Margani
Greenhorn

Joined: Aug 19, 2007
Posts: 17
Hai to all,

I got an error while compiling this code.



public boolean update1(String Uin)
{
try
{


ResultSet rs=null;
Statement st=null;
Connection con=null;
PreparedStatement ps=null;


String UIN=Uin;
String name="";
boolean flag1=false;

Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("DriverLoaded");
con=DriverManager.getConnection("jdbc racle:thin:@localhost:1521 racle","scott","tiger");
System.out.println("Connection established");
st=con.createStatement();
rs=st.executeQuery("select *from uin");
while(rs.next())
{
name=rs.getString(1);
if(name.equalsIgnoreCase(UIN))
flag1=true;
}
if(!flag1)
{
ps=con.prepareStatement("insert into uin values(?)");
ps.setString(1,name);
int i=ps.executeUpdate();
if(i>0)
System.out.println("Number is Successfully Inserted");
flag1= true;
}
return flag1;
}//try
catch(Exception e)
{
e.printStackTrace();
}
}//method


the error message is :
--------------------------
BeanLogic.java:87: missing return statement
{
^
1 error




please help me to solve this problem...
krishnamoorthy kitcha
Ranch Hand

Joined: Feb 04, 2006
Posts: 96
Hi chakrapani

put the return statement end of code like

private boolean check(){
boolean chk=false;
try{

}
catch(){

}

return chk;
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in the following code