Pankaj Rathod

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

Also you are calling System.out.println() without any argument.
7 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 ).
9 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.
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.


9 years ago
Johnson,

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 java.sun.com.

Hope I am not being preachy.
9 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?

Thanks,



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.
9 years ago