This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

why this method returns null ? please help  RSS feed

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys, i am kinda new to java, but when i am looking for the mistake, i can't find it . it looks fine. can you tell me where is the problem and how to fix it? thank you :



output:

why am i receiving null at the first object? and on the second one not?

thank you !
 
author & internet detective
Posts: 39129
723
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I run your code, I get:


The output you describe shouldn't be possible. Maybe try re-compiling in case you aren't running the same code you posted here?
 
rian bron
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:When I run your code, I get:


The output you describe shouldn't be possible. Maybe try re-compiling in case you aren't running the same code you posted here?



i copied the code i run to here, i  don't understand this, maybe i will try to copy these classes into a new file and run it there.
 
rian bron
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:When I run your code, I get:


The output you describe shouldn't be possible. Maybe try re-compiling in case you aren't running the same code you posted here?



even tho i moved these classes to other file. it returns the same output.
 
Jeanne Boyarsky
author & internet detective
Posts: 39129
723
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you saying that you still get:
mes1: Sender: null subject: null content: null date: null
mes2: Sender: google100gmail.com subject: Subject content: how's going? date: 2/1/1998
 
rian bron
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Are you saying that you still get:
mes1: Sender: null subject: null content: null date: null
mes2: Sender: google100gmail.com subject: Subject content: how's going? date: 2/1/1998



Yes
 
Greenhorn
Posts: 1
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've run your code and I got this :
mes1: Sender: google100@gmail.com subject: hello  content: How are you today? date: 1/1/2019
mes2: Sender: google100gmail.com subject: Subject content: how's going? date: 2/1/1998
 
Master Rancher
Posts: 3887
45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How exactly do you compile and run your code?
If it's from the command line then what directory are you in, and where are your files?
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!