• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Doubt in the following code

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi chakrapani

put the return statement end of code like

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

}
catch(){

}

return chk;
}
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic