null « cast « Java Data Type Q&A

Home
Java Data Type Q&A
1.bigdecimal
2.biginteger
3.bit
4.Boolean
5.byte
6.Calendar
7.cast
8.character
9.Date Time
10.Date Time Format
11.decimal
12.Development
13.double
14.enum
15.float
16.hexadecimal
17.Integer
18.Number
19.Number Format
20.primitive
21.SimpleDateFormat
22.string
23.StringBuffer
24.StringBuilder
25.StringTokenizer
26.substring
27.TimeZone
Java Data Type Q&A » cast » null 

1. Why null cast?    stackoverflow.com

I saw this piece of code somewhere and wondered: when and why would somebody do the following:

doSomething( (MyClass) null );
Have you ever done this? Could you please share your experience?

2. Why cast null to Object?    stackoverflow.com

I found a spot in some code I'm working on where null is cast to Object as it is passed to a method. Why would this be done? I am aware of

3. Casting a null object...    coderanch.com

Interesting question though.... Was busy working with JDialog today and an interesting scenario presented itself. What if you have a constructor that takes an object as an argument (as a lot of, if not most, do) but you'd like not to pass it anything such as the parent frame of a JDialog. But it has constructors which would be ambiguous if ...

4. null variable casting    coderanch.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.