• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

<Identifier> expected

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Saloon Keeper
Posts: 14306
321
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what is a, and what is b?
 
Marshal
Posts: 8418
606
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2236
63
IntelliJ IDE Firefox Browser Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic