This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Date null and String null

 
Ranch Hand
Posts: 392
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have below code where date is instance of Date

This is how I initialize date

The output is always "it is null". But why after I change to below code, it become not null?



 
Saloon Keeper
Posts: 6243
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote:This is how I initialize date

How is that correct Java syntax? Doesn't make any sense to me nor my Java-12 compiler.
 
Sheriff
Posts: 4673
308
IntelliJ IDE Clojure Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaScript maybe?
 
Saloon Keeper
Posts: 2722
354
Android Eclipse IDE Angular Framework MySQL Database TypeScript Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote:


Kotlin?
 
Ron McLeod
Saloon Keeper
Posts: 2722
354
Android Eclipse IDE Angular Framework MySQL Database TypeScript Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote: ...The output is always "it is null". But why after I change to below code, it become not null?


Can you show us a runnable example?
 
Tim Cooke
Sheriff
Posts: 4673
308
IntelliJ IDE Clojure Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh yea defo Kotlin. In which case this might help you figure out what's going on: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/to-string.html
 
We're all out of roofs. But we still have tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!