Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Harsha Vardhan Madiraju

+ Follow
since Dec 19, 2003
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Harsha Vardhan Madiraju

Hi all,

I have written a simple "HelloWorld" servlet with the following web.xml file

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

Im using Tomcat 4.1.29. what is the url i have to give in ie to execute this servlet
I have tried the following but invain

(scwcd is folder name under webapps where the servlet class is present)


But when i add the following to web.xml
and give the url as http://localhost:8080/scwcd/HelloWorldServlet
im able to execute the servlet

My question/doubt is it mandatory to give servlet mapping tag to execute a servlet ???
this is weblogic-ejb-jar.xml.............
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB//EN' ''>

<!-- Generated XML! -->
this is ejb-jar.xml.............
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' ''>
<!-- Generated XML! -->
this is weblogic-cmp-rdbms-jar.xml............

<!DOCTYPE weblogic-rdbms-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB RDBMS Persistence//EN' ''>
<!-- Generated XML! -->
hi all,
i am unable to deploy my entity bean it says" unable to locate the datasource, check ur JNDI name....."

i did configure the connection pool and the datasource at the Weblogic console with correct jndi name, also i also checked that same datsource which is configured at console, is used in deployement descriptor file .
Pls help me, thanx in advance
i'd like to thank the entire javaranch team for putting up a great site like this. Although i did not participate much in the forum but regularly i used to see the reviews of diff code examples. It indeed helped me alot.
Keep the good work going
17 years ago
hi all,
Im happy to say that i cleared SCJP 1.4 exam with 91%. Reg my preparation for this exam, first i started with Java Complete Reference, which is a good book for a guy who doesn't know much abt Java/OOPS. Then after completing the first part of that book, i continued with Complete Certification Study Guide by R&H. This book is very helpful in exam point of view. Then at last, after covering all the concepts i started taking mock exams, which are given JavaRanch Mock Exams list.
In Mock exams , Marcus Green exams are almost at the same level as the real exam , and people say that the score what u get in this exam is close to ur actual score (and it happened with me!). Next, Khalid Mughal exams at this link are tough but we can learn a lot of concepts. I used these set of exams as a learning tool rather than a testing tool.
On the whole it a great learning experience for me.
17 years ago
Hi murali,
Pls send me a copy or link of material
Hi sridhar,
int[][] ar2=new int[1][3];//Line1

Array Indexes Start from 0 not 1,so there is no ar2[1] since in line 1 u declared an array of int[1][3]
Line 2 can be replaced by
System.out.pritnln(ar2[0].length);//prints 3
hi sriram,
Thanx man for correcting me!
hi sridhar,
The Rule is
A Super Reference Variable can refer a Subclass Object.
SuperClass s = new SubClass(); //Subclass extends SuperClass is valid
the otherway isn't valid ie SubClass sb = new SuperClass()
Comin to Object Ref Casting..
Consider this Scenario

Class Fruit
Class Citrus extends Fruit
Class Orange extends Citrus
Class Lemon extends Citrus
Class Test
public static void main(String args[])
Fruit f;
Citrus c;
Orange o,or;
Lemon l;
o=new Orange();
//Object created, call it as O1
c=o;//perfectly valid going by rule, c now refers to O1
f=o; //perfectly valid Its nothing but c=o; followed f=c;
// f now refers to O1
l=o; //not valid, since l is not Superclass of o, this is called sidecasting
//This is casting, in this case both sides are of type Lemon hence no compile time error, But There will be a Runtime Exception because both classes are incompatible

or = (Orange)f; //No compile time error as explained above
// There will be no Runtime Exception also, It's like this...
f is containing a reference to O1 (Orange Object), u r trying to assign that reference to o1 which is also of type Orange.
I hope that sounds logically correct.

hi vicken,
Im running on JDK 1.4.1_02!
Hi Vicken,
The code posted by Vineela is giving compile time error!
(Running on JDK 1.4.2)
U try to copy paste this below code and compile it. This code also generates the same error

class Test
void get(int i)
void get(float i)
class Test1 extends Test
void get(float x)
public static void main(String args[])
Test1 t = new Test1();

Anyone pls explain this...
Thanx in advance
hi all,
Can anyone explain me how the below comparison is true or returns true
Math . round ( Integer . MIN_VALUE - 6.5f ) == Integer . MIN_VALUE
Thanx in advance
Hi sridhar,

suppose we r trying to find out the following
--> -3 >> 1
--> -3 << 1
--> -3 >>> 1
Note all the numbers are taken as integers (32 bits) not bytes or shorts
First see how to obtain -3's binary representation:
-3 binary code is obtained by taking 2'complement of 3's binary code.
2's complement means inverting all bits and then adding 1
Binary representation of 3: 00000000000000000000000000000011
Inverting all the bits we get: 11111111111111111111111111111100
lets add 1 to it: +
So The binary form of -3 is :11111111111111111111111111111101

so now lets see -3 << 1:
It means left shift -3 by one bit.
ie 11111111111111111111111111111101 << 1 = 11111111111111111111111111111010
Observe that in the above -3 representation, left most bit is discarded and at the right most a '0' is appended, to get the underlined representation.
So the answer is 11111111111111111111111111111010
clearly the first bit is 1, so its a negative no. In order to obtain its magnitude we have to take 2's complement of it.
So follows the above said steps
something like this...
After Inversion
Adding 1 + 00000000000000000000000000000001
00000000000000000000000000000101 = 6 in decimal form
Hence its clear that answer or result has magnitude 6 and since its a negative no. Its -6 the required answer
Hence -3<<1 = -6
Similarly u can calculate for -3>>1 and -3>>>1
hi vineela,
The O/P starts from 3 itself!
Its hard to see it on the system,
so give as
for(int i = 3; ; i++){