This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!

Rajat kumar jain

+ Follow
since Dec 22, 2011
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 Rajat kumar jain

An interface Conditions
RegularAndWeekdays, RegularAndWeekends, RewardedAndWeekdays, RewardedAndWeekends are the classes implement them
An interface Hotel
HotelX HotelY HotelZ will implement that interface
Now all the conditions concrete classes will have a reference to hotel and it will instantiates each type of hotel
these classes have a function Calculate and they will calculate the charges for each hotel and then put them into the int variables
then i will find the smallest one of these ints and return that variable.
Thank you for advice. Can you suggest me which classes should I make so as to minimize coupling and maximize cohesion. Please help me
Guyz will you please suggest me how can I proceed for this problem.

A well renowned hotel has three branches in Miami. Namely x,y and z .Each has two types of customers. Regular and Rewardee. Also each branch has its own ratings x is given a 3 star rating while y has 5 star rating and z has 4 star rating.Each hotel has specific rates for weekend and weekdays. x charges $100 for regular customers on weekdays and $120 on weekends While it is $90 for rewardee on weekdays and $95 on weekends. While z charges $195 for regular customers on weekdays and $150 on weekends. While its $120 for rewardee on weekdays and $90 on weekends. Now when the customer requests for a particular detail you need to find which hotel would yield the customer profit. In case of tie between hotels compare the ratings and provide the result.

Input format:Regular: 16Mar2010(sun), 19Mar2010(wed), 21Mar2010(Fri)

Answer: (This is the format of the question but not sure about the values).
No NO ankit i just want to cross check my answers just to make sure that i am solving it correctly
Friends I know this is not a forum to discuss but can you please help me out in solving flowchart problem
Hello all please help me in one of my doubt

actually i was writing a program in which a program has to take 3 numbers from the user and if i will not enter the third number and just press enter key then it should multiply first two numbers else it should multiply all the three numbers and show the result.
Now the problem is that
i use following statement
DataInputStream dis=new DataInputStream(;
String r=dis.readLine();

now the problem is that if i dont write anything on the console and simply press enter then what would it consider it whether it will consider it as null string(r==null) or anything else as in the following code it always excecutes if statement please reply asap guys

I have a confusion in the following concept

suppose i have a superclass animal and subclass horse

now if I write

Animal[] a=new Horse[]{new Horse(),new Horse(),new Horse()};

According to this statement what i understand is that a is reffering to an array of type Animal. But when i check it compiler shows that it means a refers to an array of type Horse. Now I agree myself with the compiler. But tell me the whole situation . What is the use of this array and diagramatically what does it mean I am really confuse.

Polymorphism does not work in Overloading functions and therefore it is decided at compile time which version to call of overloaded functions. And since the compiler is concerned only with reference type therefore it will see that you are calling the method with Mammal as an argument and thus it will call mammal version of the method. If you have some another query please post it here.
Hi Srinath jha both of the versions of overloaded methods are able to handle your request. So compiler does not have any criteria to know which of the version to call and thus it gives compile time error.

Helen Ma wrote:Hi, Glen.
Assume your current directory is still c:\glen.
If you want to compile with -classpath, you may want to try this:
javac -classpath com\scjp\dir com\scjp\dir\

Javac will look for the lower.Animal under com\scjp\dir.

But before you do that, make sure you compile and make sure Animal.class will be under
com\scjp\dir\lower directory.

To compile
javac com\scjp\dir\lower\
This will create Animal.class under com\scjp\dir\lower

But the compiler will try to search it with the fully qualified name But if you will take it into dir then it wont be able to search and will give you an error. So please check your statement again and please correct me if I am wrong
Ok glen so let me make some effort in clearing your doubt regarding your question....

please follow the following points

During compiling you should be in the directory where your .java file is located. If you are not in that directory then you should give a complete path so that compiler comes to know where is your .java file located.

For eg in your question you didnot specify but i think your file is located in geln\com\scjp\dir\ Now you should be either in C:\ directory and provide the path \glen\com\scjp\dir\ and you have to tell the compiler where is your class files that you are using in your program are located that is you have to tell it -cp \glen(javac -d \glen -cp \glen . The other option is that you set your path to C:\glen\com\scjp\dir> javac -d ..\..\.. -cp ..\..\..
You know what does 3 .. implies. ".." implies that take me out of the current directory. so first .. takes you to scjp second .. takes it to com and third .. takes it to glen where your class file glen\com\scjp\dir\lower\Animal.class is located. So in this way you can use -cp in javac. Hope i am clear to you. I have also spent sleepless nights on this concept hope this is clear to you. If you need any other help then i am always there for you.
For this consider the following point

The polymorphism works only on runtime due to which at compile time the compiler considers that you are trying to call a function from superclass which is throwing an exception which you have to catch or declare it to be thrown so thats why it is reporting an error unreported error....
Hi ranchers Please help me i am in confusion of whether i should specify my SCJP score on my resume or not. I got 98% in SCJP but one of my senior told me that interviewers ask very-2 tough questions after seeing this much high percentage. So I want to ask you is that ok if I will not specify my score on my Resume or should i specify. Please help me with this confusion. I am very less confident person so thinking these type of things...
Thank you all for your good wishes..

Larsen Raja wrote:hi,

I have read K&B bok around3-4 times. I still keep reading. But I am still not confindent to take the cert exam. I have even tries K&B ptractice exams, where I have scored 70+ in all the 4 practice exams. I have also tries questions from javachamp and other mock websites. Though questions from these two websites looked simple to me, I couldnt imagine the real exam. I fear I myt not pass.


Hey Larsen your score seems to be very good as compare to mine and i am sure if you will master all these then you will definitely pass the exam with good score. Also try to master the examlab these will prove to be very very useful to you. And set your deadline so that you can see the target in front of you to hit on and go through as much mocks as you can. Rest will be fine dont worry. Bet of luck.