Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Pankaj Rathod

+ Follow
since Feb 02, 2009
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 Pankaj Rathod

Also you are calling System.out.println() without any argument.
8 years ago
The question is actually asked in an interwiew. The interviewers does not seek 100% definate/correct answer to such questions.

From that point of view, I think, one can answer the question of Java being an purely OO in affirmative and argue that in java there are Wrapper classes (Objects) for every primitive type and one can use Interger Object in place of int primitive wherever needed.

In any case, whether you say yes or no, the interviewer will challenge your position on such issues. So just pick up one line of theory which you are comfortable in and defend your position in all possible ways.

Thats the way in an interview (not life ).
11 years ago
Method to calulate day of week.

(works for year from 1900) (takes care of leap years)

Example date: 16-Feb-2009

Edit: The method posted was wrong. Realised the mistake.
11 years ago
For your first question:

Method over-loading and over-riding, both are form of polymophism.

However, there is a difference.
Over-riding exhibits Dynamic-polymorphism or run-time polymorphism.
Which Method call is decided at run-time by the JVM.

In method over-loading, the specific method to be called is decided at compile time.

This is what basics I know. There may be more to it.

11 years ago

Its nice that you are learing Java.

But I think (and guessing from your original question) that the code you provided is not the best way to get started in Java. You need to start with a pretty basic program (like the traditional HelloJava/HelloWorld) and then build up by learing concepts one by one.

You can start with Java Tutorial on

Hope I am not being preachy.
11 years ago

nis bootwala wrote:Hi...

Is there any thing like setLenient property which I can set to false in java.util.Date and java.util.Calendar?


Yes, there is. Go through the methods of the Calendar class carefully in the API (link provided by Campbell in earlier post). You will find a method 'void setLenient(boolean)' which you can use to set Calendar to non-lenient mode.

Using this, 04/31 will not be converted to 05/01 rather an Exception will be thrown.
11 years ago