answersLogoWhite

0


Best Answer

A Java method declaration will look like this:

[access modifier] [static] [final] [synchronized] [return type] [method name]([parameters])

Where:

access modifier is exactly one of the following

  • public
  • protected
  • (no text)
  • private

static, final, and synchronized are all optional.

return type is exactly one of the following

  • void
  • The name of a Java primitive
  • The name of a Java class

method name is a valid Java identifier which must conform to all of the following rules

  • Starts with a lowercase letter (a-z), an uppercase letter (A-Z), a dollar sign ($), or an underscore (_)
  • After the first character, may be a digit(0-9), a lowercase letter (a-z), an uppercase letter (A-Z), a dollar sign ($), or an underscore (_)
  • May not be one of the Java keywords
  • May not be one of the Java literals: true, false, or null

parameters is a comma-separated list of [type] [identifier] pairs, where:

  • type is a valid Java primitive or class name
  • identifier is a Java identifier, which conforms to the same rules as method name
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: General syntax in creating a method?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

What is the general syntax for inline image?

The general syntax for an inline image in HTML is: <img src="image.jpg" alt="Description of image">


What is one method of creating multimedia?

What is one method of creating multimedia?


What is the syntax in creating an object?

class_name object_name=new class_name(); eg: A a=new A();


What is the required syntax for creating C arrays?

The required syntax for creating C arrays include the brackets, array size, variety length arrays, codes like std:vector, classPTR, and many more to create C arrays.


What has the author H R Stokoe written?

H. R. Stokoe has written: 'The understanding of syntax' -- subject(s): Comparative and general Grammar, Grammar, Comparative and general, Syntax


What step in scientific method involves creating a chart graph?

In the general category of communicating your results. most call it "analyzing results"


What has the author David Adger written?

David Adger has written: 'Mirrors and microparameters' -- subject(s): Syntax, Comparative and general Grammar, Kiowa language 'A syntax of substance' -- subject(s): Comparative and general Grammar, Phrase structure grammar, Semantics, Syntax


What has the author Michael Ridley Thomas written?

Michael Ridley Thomas has written: 'Natural syntax and Indonesian' -- subject(s): Comparative and general Grammar, Grammar, Comparative and general, Indonesian language, Syntax


What has the author Edwin Samuel Williams written?

Edwin Samuel Williams has written: 'Rule ordering in syntax' -- subject(s): Comparative and general Grammar, English language, Grammar, Comparative and general, Syntax


What are the basic syntax of c program?

You have to be more specific. What part of C syntax? Do you want the syntax for outputing a number or sentence, do you want to syntax for creating a array, struct, a user defined function or what? #include iostream using namespace std; int main { cout << "Hello World!" << endl; return 0; };


What has the author Chiara Polo written?

Chiara Polo has written: 'Word order between morphology and syntax' -- subject(s): Comparative and general Grammar, Grammar, Comparative and general, Morphology, Syntax, Word order


What has the author Franz Schmidt written?

Franz Schmidt has written: 'Symbolische Syntax' -- subject(s): Language and languages, Philosophy 'Logik der syntax' -- subject(s): Comparative and general Grammar, Logic, Syntax