Languages
[Edit]
EN

Java - methods naming convention, ideas and examples

3 points
Created by:
Bartek
2120

Methods in java should be named as verb.

Method names examples in java:

  • set
  • get
  • is (isDone)
  • read
  • write
  • execute
  • make
  • run
  • call
  • give
  • calculate
  • send
  • find
  • add
  • subtract
  • invoke
  • select
  • delete
  • insert
  • update
  • move
  • go
  • cancel
  • do
  • append
  • pay
  • look (look for somethin
  • count
  • flush
  • register
  • unregister
  • deregister
  • put
  • change
  • connect
  • disconnect
  • parse
  • reset
  • build
  • clear
  • contains
  • check
  • serialize
  • deserialize
  • replace
  • equals
  • end
  • endsWith
  • startsWith
  • compare
  • convert
  • exchange
  • revert
  • contains
  • concatenate
  • toLowerCase
  • toUpperCase
  • split
  • match
  • isEmpty
  • indexOf
  • offset
  • split
  • notify
  • wait
  • determine
  • designate
  • addAll
  • iterate
  • trim
  • reduce
  • cut
  • restrict
  • limit
  • confirm
  • fix
  • acknowledge
  • install
  • focus
  • setUp
  • repair
  • attach
  • reset
  • adapt
  • bind
  • mark
  • record
  • enroll
  • reject
  • peak
  • see
  • quit
  • display
  • create
  • collect
  • commit

Usually used in scripting:

  • kill
  • start
  • stop
  • restart
  • relaunch
  • keep it alive

Other useful example:

  • giveDirection
  • calculateDistance
  • makeSomething
  • append (StringBuilder, Builders in general)
  • run (Runnable)
  • get, set (java pojos)
  • isDone (java boolean)
  • isDetected
  • toFixedPrecisionIfNotNull

Also take a look at post with java class, utils, interface naming convention and examples here:

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Dirask - my favourite posts

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join