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

<Identifier> expected  RSS feed

 
Aradhya Chawla
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I was trying to write this code here, but when I try to compile it I get an error
<identifier> expected on "public static int lel(a,b)"

As a beginner I don't know where the mistake is

 
Stephan van Hulst
Saloon Keeper
Posts: 7805
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what is a, and what is b?
 
Liutauras Vilda
Marshal
Posts: 4635
316
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Please choose carefully forum where you post your question. I just moved your thread to Beginning Java forum as Ranch Office is designated for other purposes.

About your question:
1. Check carefully line 9 of your code. Method parameters has to be defined by specifying their data types.

2. Also little advice - do not name classes as "T", methods as "lel", variables as "a", "b" or any other similar non descriptive names.
I know that for a quick practice cases feels not needed to spend time for carefully choosing variables names - but that is not true, it requires a fair amount of time to get used to it.
 
Paweł Baczyński
Bartender
Posts: 2054
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And your method won't do what you expect it to do.
Namely, it will not swap the values of static variables a and b nor the any values passed to it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!