Roopam Samal

Greenhorn
+ Follow
since Oct 08, 2013
Merit badge: grant badges
For More
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 Roopam Samal

Hi

1>If I'm manually starting tomcat and executing a web app then i'm mentioning the port no. in server.xml
but if I'm using IDE eclipse then why I don't need to mention anything in server.xml........

2>If I'm not using IDE eclipse then to test tomcat I use URL:http://localhost:8012/
But If I copy url from eclipse browser and edit it to http://localhost:8019/ and run it then resource not found(Http 404 error)....why???

Description of 2>

In my eclipse if I'm running any web app in eclipse which uses port 8019 and I'm pasting that in
browser it works f9.
for ex:

http://localhost:8019/test34/NewFile.jsp



But if I use Url :

http://localhost:8019/

then i'm getting http status 404 resource not found error.why???

I didn't mention anything regarding this port:8019 in server.xml still how it is working???


thanks in advance
10 years ago
Hi everyone

How does web server differentiates between request for static web page and request for
dynamic web page?

I'm not sure but i think if web server receives request for static page directly renders that to server
or else if request is for dynamic web page passes that to web app which processes the request and
renders that to client. bUT how does web server differentiates between both the request.

thanks in advance
10 years ago
Hello everyone
If i'm importing any classfile present in
the package other than java.lang say for example
java.io.File,then when i use javac to compile then
compiler should search for "java" package in classpath
mentioned
.My environment variable is
C:\Program Files\Java\jdk1.5.0_06\bin so compiler should
search for the "java" packge in C:\Program Files\Java\jdk1.5.0_06\bin
directory and in this directory there is no java folder so
How is the things working???



thanks in advance
with regards
In Nov 05-2013 I appeared OCPJP exam and I qualified the exam with 88%,missed 90-100% belt for my stupid mistakes
This website helped a lot during my preparation for the exam.thanks to the entire team..

Now I downloaded the e-certificate.I'm not impressed with the ID-proof provided in the e-certificate.
If anyone with name same as of mine has done certification in the same date then he/she will have completely same certificate as of me...
It should be unique..
Oracle team should think about it..

Another problem is that it doesn't mention percentage score in the e-certificate so 61% n 100% has no difference...

I have a request for all of u.I'm continuing last year f my b-tech now.
I have a offer from MNC and I want to increase my accolades before joining the company so kindly suggest me
what more certification I should pursue so that I can work perfectly in the field of java


thanks in advance


Hi Pawel
In the above program if before #1
if Thread.sleep(600) is added then main thread
goes to sleep for 600ms for sure so only other user-defined
thread
sitting in the runnable pool should definitely
get executed and much before 600 ms it should
complete and die..


Therefore Output is guaranteed.....(3) is correct
and in similar fashion (5) is also correct

The other thread might take five seconds to start to run.



But what I know is,thread started means it goes to runnable pool
and here if main thread goes to sleep the only other thread in runnable pool
is bound to run..........

please tell me where my understnding has gone wrong???

thnks in advance


10 years ago



1.) At #1 the value of x is guarenteed to be 11

2.) At #2 the value of x is guarenteed to be 12

3.) If a Thread.sleep(500) is added just before #1, x is guarenteed to be 11

4.) If a Thread.sleep(500) is added just before #2, x is guarenteed to be 12

5.) The output of this program cannot be guarenteed

6.) The runnable implementation is an anonymous inner class


Answer: (5),(6)

the above question is from Certpal Mock test 1.6 part 2

But My answer is (3),(4),(6)

who is correct??n why?




Also please suggest me some realistic free mock test conducting websites...

thnks in advance


with regards
10 years ago
How do you improve the coupling between these classes ?




1.) Mark int x=5 private and provide accessor fields to it

2.) Mark the variable z private

3.) Pass only the value of x instead of Main to quacker().

4.) Provide getters and setters for the variable z

5.) Remove IS A relation ship of Main with Duck

Answer: (1),(3)
The above code is from CertPal mock exams
To increase coupling one class shouldn't know
about other class anything other than API
so (1) is correct as it restricts access of field of Main by Duck
so here I wounder why (2),(4),5) isn't correct and why (3) is correct
and also if we remove Is a Relationship then
Main and Duck loosly coupled in a better way perhaps as they can't know anything
about each other..


Also tell me when any class with strong encapsulation has tight coupling with other classes
is it possible that 2 class have strong encapsulation and tight coupling??


thnks
10 years ago
thanks Ritchi for pointing the spelling mistake.
I hav modified it to reduce confusion
10 years ago


1>Hello everyone I understand the code but my question is
super:its a keyword used to invoke base accessible members
but can you tell me its equivalent meaning i.e in case of fields its just upcast of this and then invokation of field ex:super.name in beer is equivalent to ((Animal)this).name
similarly what is its equivalence in case of method invokation using super keyword.

2>In this above code in Animal.check() when we call run(), it makes a call using this and this is pointing to Bear object so overriding method is invoked due to runtime polymorphism
but super is used to invoke base members.Though it seems like reference variable holding base object but its not true.super is not a variable not like this(final variable)
how is it able to access base object's member??what internally goes on for super keyword which isn't a variable unlike this??

thanks in advance
10 years ago

What is the result?
A. w-f
B. f-p w-f
C. w-f b-f
D. f-p w-f b-f
E. Compilation fails.
F. An exception is thrown at runtime.
Answer: B


Hello everyone I have understood the code.I'm writting below my understanding please rectify it if necessary

Here 1st lets check is there any possibility of compilation error.

As f is reference of Fish type so it can hold instance of Walleye or Perch
(i.e.,Fish type reference can be assigned to Walleye or Perch object as they lie below it in class hierarchy) and here test is done with respect to Perch so compiler doesn't complain
then in second if expression w is reference of Walleye type so it can hold instance of Walley which is a Fish and here its tested with respect to Fish so compiler doesn't complain
In 3rd case b is reference of BlueGill type it can hold BlueGill instance or its subtype and if its a Fish(i.e.,subtype of Fish) then instaneof check might be true so compiler doesn't complain.

As there is no possibility if compilation error lets move runtime where we will check which if expression gives true and what gives false

Here f holds Walleye object which is a Perch so if it is checked with instanceof Perch then it gives true so f-p is printed
next w holds Walleye object which is a Fish so if its checked with instanceof Fish then it gives true so w-f is printed
then b holds BlueGill object which isn't Fish so if its checked with instanceof Fish then it gives false so b-f isn't printed.


kindly check my understanding and rectify it accordingly


thanks in advance
with regards
Roopam
10 years ago
Hi Ritchi
I have understood how to discard tokens.


If any other better way is available then please tell me.


thanks
10 years ago
thanks stuart for telling the much easier way to search a file in a directory

In the previously written code if I use equals() instead of == it works fine as pointed out by Paul.
But i can't understand reason.


when compiler encounters string literal compiler checks if a identical string exists already or not if yes then reference to new literal is directed to existing string
so reason for it is:tt.txt is not already present in pool therefore this s[37]=="tt.txt" gives false. please rectify my mistake in understanding.


thanks in advance
10 years ago
thanks Ritchi. I understood now.
If next token doesn't match Integer regular expression or out of range then InputMismatchException occurs
and here next token is "sue" which doesn't match Integer regular expression so this exception occured

And if I modify the above code to

then output is 5 since next token matches Integer regular Expression.
10 years ago
Hello Joel

If I change my code to


then also I'm getting same InputMismatchException.
what i know is nextxxx() get next token and then move to next token.
so 1st token Sue isn't matched then next token 5 is matched thus output should be 5 from my perspective but it doesn't. can't understand why???
please explain it


thanks
10 years ago


here the output is java.util.InputMismatchException

what I have understood is if useDelimiter(",") were not used here then as default delimiter is space and jvm doesn't find any space in given scanner input and as a result of which output is InputMismatchException
If I'm wrong please correct me.
can you please highlight the reason of this exception in my code??
also explain when and why this exception comes if possible with examples

thanks in advance
10 years ago