This week's giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Production-Ready Serverless (Operational Best Practices) and have Yan Cui on-line!
See this thread for details.
Win a copy of Production-Ready Serverless (Operational Best Practices) this week in the Cloud/Virtualization 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
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

why this method returns null ? please help  RSS feed

 
Ranch Hand
Posts: 101
  • 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: 39195
725
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: 101
  • 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: 101
  • 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: 39195
725
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: 101
  • 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: 4
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
 
Rancher
Posts: 3983
47
  • 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?
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!