Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Methods return array  RSS feed

 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I want it prints 2 3 4

But it prints:
1 2 3
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16026
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem has nothing to do with arrays, it's because you are doing value = value++ while you really meant to do just value++.

See: Post Increment Operator And Assignment
 
Death Arte
Greenhorn
Posts: 21
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



you can create 2 classes in one Java file but make sue that the Array parameter is not declare as public.

once you compiled it, it automatically generated in two classes file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!