This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

satya narayan reddy

Greenhorn
+ Follow
since Nov 26, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by satya narayan reddy

hi all,
can anybody please fix why the below program is giving classnotfoundexception

thanks in advance,
satya

import java.sql.*;
import java.io.*;
public class JDBCTest
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JDbcOdbcDriver");
Connection c = DriverManager.getConnection("jdbc dbc:venkatdsn");
Statement st = c.createStatement();
ResultSet rs =st.executeQuery("Select sno,sname from student");
try
{
while(rs.next())
{
System.out.println(rs.getInt("sno")+":");
System.out.println(rs.getString("sname"));
}
}
catch(Exception e)
{
System.out.println("inside:"+e);
}
}
catch(Exception e)
{
System.out.println(e);
}

}


}


Runtime Exception:
--------------------
java.lang.ClassNotFoundException:sun.jdbc.odbc.JDbcOdbcDriver
import java.util.*;
public class VectorMethodsDemo
{
public static void main(String args[])
{
Vector v = new Vector();
System.out.println(""+v);
System.out.println(""+v.size());
System.out.println("" +v.setSize(9));//1
System.out.println("" +v.setElementAt("ramu",5));//2
}
}

Hi all,
Can anybody tell me why the above program with respect to comments 1 and 2 are showing :
void not allowed here as the compile time error

thanks,
satya
16 years ago
Thanks Jasper and campbell..the error got fixed
16 years ago
Thanks mates for your valuable information....

thanks,
satya
16 years ago
import java.util.*;
public class Vector
{
/*public Vectors(int x,int y)
{
System.out.println("in the vector constructor");
}*/
public Vector()
{
System.out.println("in the empty constructor");
}
public Vector(int x ,int y)
{
System.out.println("in the vector constructor");
}
public Vector(int z)
{
System.out.println("in the vector with storage capacity");
}
public boolean addElement(Object obj)
{
System.out.println("added into the vector");
return true;
}
public final int capacity()
{
System.out.println("capacity of the constructor");
return 6 ;
}
public final boolean contains(Object obj)
{
System.out.println("in the contains method");
return true;
}
public static void main(String args[])
{
Vector v = new Vector(5,1);
System.out.println("" +v);
Vector w = new Vector(3);//capacity is 3 but still taking velagala>3
System.out.println("" +w);
Vector x = new Vector();
System.out.println("" +x);
boolean c=x.addElement("venkat");
System.out.println("" +c);
boolean d = w.addElement("velagala");
System.out.println("" +d);
System.out.println("" +w.capacity());//y this is not returning the capacity
//of the vector
boolean f=x.contains("simha");//y this is method is returning true when there is no simha in the vector collection named x
System.out.println("" +f);
}
}

hi all,
i have few queries with the above program.
can anyone try to fix the problems which i placed in the comments

thanks,
satya
16 years ago
public class String2Int{
public static void main(String argv[]){
try{
int i= Integer.parseInt(argv[0]);
System.out.println("Coverted to int val = " + i);
}catch(NumberFormatException nfe){ System.out.println("Could not covert to int");
}
}
}

runtime exception:
------------------

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at String2Int.main(String2Int.java:7)


Hi all,
for the above program its generating the above runtime exception can anybody
fix the problem?

thanks,
satya
16 years ago
public class NumberFormats
{
public static void main(String argv[])
{
System.out.println(Integer.toBinaryString(4));
System.out.println(Integer.toHexString(16));

}
}

output:
------
100
10

hi all
how the output for the above program is giving 100 and 10.can anybody
explain me how the output is being generated?
16 years ago
import java.util.*;
public class VecNum
{
Hi iam unble to understand the below program.can anybody explain the program flow?i will be thankful if anybody helps me out.

Thanks,
satya

public static void main(String argv[])
{
Vector v = new Vector();
v.add(new Integer(1));
v.add(new Integer(2));
for(int i=0; i < v.size();i ++)
{
Integer iw =(Integer) v.get(i);
System.out.println(iw.intValue());
}
}
}
16 years ago
hi jaenne
Thanks for your suggestion errors are fixed.

thanks
satya
16 years ago
public class StringMethods
{
static String str= "abc";
String name = "venkat";
String qualifi= "mca";

public void StringMethods2()
{
System.out.println("" +name.charAt(0));
System.out.println("" +name.compareTo(qualifi));
System.out.println("" +name.concat(qualifi));
//System.out.println("" +name.endsWith("t"));
}

public boolean endsWith(String str)
{
System.out.println("in the endsWith method");
}

StringMethods()
{
System.out.println("in the default constructor");

}
public static void main(String args[])
{
StringMethods sm = new StringMethods();
sm.StringMethods2();
System.out.println("" +str.charAt(2));
boolean b = sm.endsWith("r");
}
}

Hi all,
The above program is giving compile time errors.Can anybody fix the errors

Thanks,
reddy
16 years ago
Hi Ko Wey,
Thanks for your suggestion but still iam getting comiple time errors as:

objectDemo.java:7: getClass() in objectDemo cannot override getClass() in java.l
ang.Object; overridden method is final
public Class getClass()
^
objectDemo.java:28: cannot resolve symbol
symbol : variable ramu
location: class objectDemo
od.equals(ramu);
^
objectDemo.java:29: cannot resolve symbol
symbol : variable venkat
location: class objectDemo
od.copy(venkat);
^


I can be thankful if anybody fixes these errors

Thanks,
VSNReddy
16 years ago
hi lancar
this is what the compiler is giving the errors.
so please tell me how to solve this errors

thanks,
reddy

objectDemo.java:28: ')' expected
od.equals(Object ramu);
^
objectDemo.java:29: ')' expected
od.copy(Object venkat);
^
16 years ago
hai iam new to this forum and new to java world too and hope u all will help me out in answering to my queries:

why the below program is giving the comiple time errors:
public class objectDemo
{
objectDemo()
{
System.out.println("iam in the construtor jectDemo()");
}
public Class getClass()
{
System.out.println("returns the class of the object");
}
public int hashCode()
{
System.out.println("returns the hashCode of the object");
}
public boolean equals(Object obj)
{
System.out.println("returns the boolean value of the object");
}
protected void copy(Object src)
{
System.out.println("copies the contents of specified into the current object");
}
public static void main(String args[])
{
objectDemo od = new objectDemo();
od.getClass();
od.hashCode();
od.equals(Object ramu);
od.copy(Object venkat);
}

}
16 years ago