Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Rajani Sudhakar

Ranch Hand
+ Follow
since Apr 28, 2004
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 Rajani Sudhakar

Hi Lasse,

Thankyou.
I removed the name and type attributes from <html:form>

Now i am a getting a new exception.


HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception creating bean of class first.LookupForm: {1}
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)


root cause

javax.servlet.ServletException: Exception creating bean of class first.LookupForm: {1}
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:95)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)



--------------------------------------------------------------------------------

Apache Tomcat/4.1.30

Waiting for a faster reply,

Rajani.
15 years ago
Hi David,

Thankyou for your reply..
I am reading the same book..
But i dont have the struts.jar file in my JAVA-HOME\jre\lib\ext directory.
I have struts.jar file in the following:

C:\jakarta-tomcat-4.1.30\server\webapps\admin\web-inf\lib
C:\jakarta-tomcat-4.1.30\webapps\struts\web-inf\lib
C:\jakarta-struts-1.2.4\contrib\struts-el\lib
C:\jakarta-struts-1.2.4\lib

Does the exception has anything to do with the struts-html.tld file?

I am not able to proceed further without solving this..
Please help me out..

Thankyou,
Rajani.
15 years ago
Hi guys..
I am deploying my first struts application.
I got held up at an exception.

I am including the details here:

my root directory is C:\jakarta-tomcat-4.1.30
I created a directory by name "struts" in webapps.
(C:\jakarta-tomcat-4.1.30\webapps\struts)
I created the directory "web-inf" and index.jsp is my first view.

C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF.
C:\jakarta-tomcat-4.1.30\webapps\struts\index.jsp

I copied all the jar files from C:\jakarta-struts-1.2.4\lib to
C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\lib\

__________________________________________________________________________
index.jsp:

<%@ page language="java" %>
<%@ taglib
uri="/WEB-INF/struts-html.tld"
prefix="html" %>
<html>
<head>
<title> First Struts Application</title>
</head>

<body>
<table width="500" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td height="68" width="48%">
<div align="left">
<img src="images/Cloud.gif">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>

<html:form action="Lookup" name="lookupForm"
type="first.LookupForm">
<table width="45%" border="0">
<tr>
<td>Symbol:</td>
<td><html:text property="symbol" /></td>
</tr>
<tr>
<td colspan="2" align="center">
<html:submit />
</td>
</tr>
</table>
</html:form>

</body>
</html>
_______________________________________________________________________

I included the following in web.xml:
C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\web.xml

<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>
/WEB-INF/struts-html.tld
</taglib-uri>
<taglib-location>
/WEB-INF/struts-html.tld
</taglib-location>
</taglib>

I copied struts-html.tld from C:\jakarta-struts-1.2.4\lib to
C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\


ActionForm and Action :
C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\classes\first
LookupAction.java
(Package first contains 2 classes :LookupAction and LookupForm)
__________________________________________________________________________
package first;

import java.io.IOException;
import javax.servlet.ServletException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class LookupAction extends Action
{

protected Double getQuote(String symbol)
{

if(symbol.equalsIgnoreCase("SUNW"))
{
return new Double(25.00);
}

return null;
}

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException,ServletException
{
Double price=null;
String target=new String("success");

if(form!=null)
{
LookupForm lookupForm=(LookupForm)form;
String symbol=lookupForm.getSymbol();
price=getQuote(symbol);
}

if(price==null)
{
target=new String("failure");
}
else
{
request.setAttribute("PRICE",price);
}

return (mapping.findForward(target));
}

}

class LookupForm extends ActionForm
{

private String symbol=null;

public String getSymbol()
{
return (symbol);
}

public void setSymbol(String symbol)
{
this.symbol=symbol;
}

public void reset(ActionMapping mapping,HttpServletRequest request)
{
this.symbol=null;
}

}
___________________________________________________________________________
I compiled the above java file. The corresponding class files are in
C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\classes\first\

The struts-config.xml contains :
(C:\jakarta-tomcat-4.1.30\webapps\struts\WEB-INF\struts-config.xml)

__________________________________________________________________________
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config
PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-
config_1_1.dtd">

<struts-config>

<form-beans>
<form-bean name="lookupForm"
type="first.LookupForm"/>
</form-beans>


<action-mappings>

<action path= "/Lookup"
type="first.LookupAction"
name="lookupForm" >
<forward name="success" path="/quote.jsp"/>
<forward name="failure" path="/index.jsp"/>
</action>

</action-mappings>

</struts-config>
______________________________________________________________________

The second view is quote.jsp

___________________________________________________________
<html>
<head>
<title>First Struts Application</title>
</head>
<body>

<table width="500"
border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td height="68" width="48%">
<div align="left>
<img src="images/wxmainlogowhitespace.gif">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
Current Price: <%=request.getAttribute("PRICE") %>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
____________________________________________________

Finally the web.xml file has :
________________________________________________________
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>

<!-- Standard ActionServlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>WEB-INF/struts-config.xml</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>

<!-- Standard ActionServlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- Standard Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>
/WEB-INF/struts-html.tld
</taglib-uri>
<taglib-location>
/WEB-INF/struts-html.tld
</taglib-location>
</taglib>

</web-app>

___________________________________________________________________________

Now when i try to open the index page, by
http://localhost:8080/struts/

i am getting the following error:

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /index.jsp(30,0) Attribute name invalid according to the specified TLD
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:186)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:498)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:707)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:1070)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:1076)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:232)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
at org.apache.jasper.compiler.Validator.validate(Validator.java:607)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:230)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)



--------------------------------------------------------------------------------


I guess i have done everything perfect.
Can anyone help me out from this exception?

Thanks in advance,

Rajani.
15 years ago
OOPS !
Sorry....

That was a typing mistake ...
it wasn't jdl1.18 but its jdk1.1.8

but i get the same syntax error

rajani.
16 years ago
Hi..

Let me be clear..

I installed jdk1.1.8 and Tomacat4.1.30.
I have set the environment variables as follows:

set JAVA_HOME=c:\jdk1.1.8
set CATALINA_HOME=c:\ jakarta-tomcat-4.1.30

when i start the server , i get a syntax error as follows"

c:\jakarta-tomcat-4.1.30\bin>startup
Syntax error
Using CATALINA_BASE: ..
Using CATALINA_HOME: c:\jakarta-tomcat-4.1.30
Using CATALINA_TMPDIR: ..\temp
Using JAVA_HOME: c:\jdl1.1.8

A window is displayed and disappears in no time.

HOw can i fix this?

Thanks in advance,
Regards,
Rajani.

16 years ago
Hi all..

I am new to Servlet programming.I installed jdk1.2.1 and jsdk2.1 on my machine.
I created a HelloServlet program and compiled it by appropriately setting the classpath..

i tried to start the server by the following

c:/jsdk2.1/>startserver.

but when i tried http://localhost:8080 in internet explorer,
i couldn't get anything..

Please anyone help me out..

Thanks in advance,
Regards,
Rajani.
16 years ago
Hi

I gave the SCJP1.4 today..
Got 81% .
Not that much satisfied but... well its fine.

Thhanks a lot to K&B book.
The various posts in the saloon and the mock exams
also helped me a lot..

Thanks a lot once agian......

Regards,
rajani.
16 years ago
I was stuck up at the following question from one of the mock exams.


Which of the following are true

1. A.java cannot be compiled. Duplicate defination of inner class B.

2. A.java compiles without any error. An attempt to run C as an application will cause runtime linkage error. Duplicate definations of inner class B are found

3. Only one class file corresponding to the inner class B is created in the file system.

4. Two class files corresponding to both inner classes (B) is created in the file system.

5. The classes compile cleanly and on running C as an application causes "I am in the arg constructor" to be printed on the console

Corredct Answer : 4 and 5.

I am satisfied with option 5.
Coming to option 4, the main method has the code A a = new A(1);
which executes the following code:

So how two class files corresponding to both inner classes (B) are created in the file system ?

Thanks in advance,
Rajani.

Edited by Corey McGlone: Added CODE Tags and Reformatted Code for Readability.
[ June 07, 2004: Message edited by: Corey McGlone ]
Class fields with the following modifiers will not be serialized

1.private
2.static
3.transient
4.protected

Answers:
2.static
3.transient

Transient fields cannot be serialized..
But about "static"?

Thanks in advance,
rajani.
Assume that 'th' is an instance holding a thread object.
th.start() causes the thread to start running and eventually complete its execution.
The object referenced by 'th' is not accessible any more and is garbage collected when the garbage collecter runs.

True / False

The given answer is false.

When 'th' is no long reachable... its elligible for garbage collection.
In the question above, there is a phrase "when the garbage collecor runs"..
So is it not true that when the garbage collector runs, the object referenced by 'th' is garbage collected?

Thanks in advance,
rajani.
Which of the following are true about the class defined inside an interface

1.it is not possible in the java Laungage.
2.The class is always public.
3.The class is always static.
4.the class methods cannot call the methods declared in the interface.
5.the class methods can call only the static methods declared in the interface.

Answers : 2,3,4.

What is essential to be known about classes defined in an interface?
I know nothing about it.
Would be greatful if anyone helps me

Thanks in advance.
rajani
Given the following code,

_____________________________________________________

public class NiceThreads implements Runnable
{
public void run()
{
while(true)
{
}
}

public static void main(String args[])
{
NiceThreads nt1 = new NiceThreads();
NiceThreads nt2 = new NiceThreads();
NiceThreads nt3 = new NiceThreads();

nt1.run();
nt2.run();
nt3.run();
}
}

_______________________________________________________________
1.The code does not compile - "nt2.run() is never reached"
2.The code compiles and runs 3 non ending non demon threads.
3.The code compiles but runs only 1 non ending, non demon thread.


Correct Answer : 3.
The code compiles but runs only 1 non ending, non demon thread.

I expected the answer to 2.

Can anyone explain me the correct answer?

Thanks in advance,
rajani.
Given the following snippet:
______________________________

if( "String".endsWith(""))
Sytem.out.println("True");
else
System.out.println("False");
______________________________
The code produces
1.True
2.False

Correct answer is 1.true

--------------------
Another snippet given:

if( "String".startsWith(""))
Sytem.out.println("True");
else
System.out.println("False");
____________________________

The code produces
1.True
2.False

Correct answer : 1.True.

Are the methods "startsWith()" and "endsWith()" in the scope of SCKP1.4 exam?
If yes, can anyone the send me the appropriate link about these methods?
What are the other specific methods related to Strings that are to be known for the exam?

Thanks in advance,
rajani.
Read this piece of code carefully

__________________________________________________________

if("String".replace('g','G') == "String".replace('g','G'))
System.out.println("Equal");
else
System.out.println("Not Equal");

___________________________________________________________
Answers

1.the code will compile an print "Equal".
2.the code will compile an print "Not Equal".
3.the code will cause a compiler error

Correct Answer : 2.the code will compile and print "Not Equal"

But the result String formed on the lefthand side and that of the righthand side seem to be equal..

Can anyone justify the correct answer?

Thanks in advance,
rajani.
Does Java allow multiple inheritancs of Interfaces?

eg: interface1 extends interface2,interface3

Is it legal?

Thanks in advance,
Rajani.