answersLogoWhite

0

What is fixed methods in java?

Updated: 8/10/2023
User Avatar

Wiki User

12y ago

Best Answer

A java method is a series of statements that perform some repeated task. Instead of writing 10 lines of code we can put those ten lines in a method and just call it in one line. It is like a shortcut.

For example if we had to repeatedly output a header such as: System.out.println("Feral Production");

System.out.println("For all your Forest Videos");

System.out.println("427 Blackbutt Way");

System.out.println("Chaelundi Forest");

System.out.println("NSW 2473");

System.out.println("Australia");

We could put it all in a method like this: public static void printHeader(){

System.out.println("Feral Production");

System.out.println("For all your Forest Videos");

System.out.println("427 Blackbutt Way");

System.out.println("Chaelundi Forest");

System.out.println("NSW 2473");

System.out.println("Australia");

}

And to call it we simply write: printHeader();

And it will print out:

Feral Productions

For all your Forest Videos

427 Blackbutt Way

Chaelundi Forest

NSW 2473

Australia

Java methods provide us with features to pass arguments to it and also return values from it.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

A Method in Java is a piece of code that is designed to perform a specific operation. It takes in input arguments processes them and then returns a value.

Ex:

public int sum(int a, int b) {

return a + b;

}

The above method takes two integer arguments and returns the sum of the two numbers passed.

This answer is:
User Avatar

User Avatar

archanapr600

Lvl 7
2y ago

fixed method means is one which cannot be overridden by a subclass. A fixed method can be declared by prefixing the word-final before a method. We can use the keyword final to donate a constant.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

java programming

This answer is:
User Avatar
User Avatar

G Kavitha

Lvl 1
2y ago
What is fixed method in java

Add your answer:

Earn +20 pts
Q: What is fixed methods in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions