Java class methods

Class method

A method that belongs to a class. The definition of the class method is "public static return type method name ()". Class methods can be called without instantiating. [Example] Person class

Person.java


class Person {
public static return type method name() {
    //Method processing
  }
}

[Example]

Main.java


class Main {
  public static void main(String[] args) {

~abridgement~

    Person.printCount();
  }
}

Person.java


class Person {
  public static int count = 0;

~abridgement~

  public static void printCount() {
    System.out.println("The total is" + count + "is");
  }
}

Recommended Posts

Java class methods
Java methods
Java methods
About Java class variables class methods
[Java] Class inheritance
Various methods of Java String class
java Scanner class
Java HashMap class
java (abstract class)
[Java] Nested class
Java anonymous class
About Java class
String class methods
How to use class methods [Java]
[java] abstract class
[Java] Object class
Java local class
About class division (Java)
About Java StringBuilder class
[Java] About Singleton Class
Java inner class review
Java class type field
Java programming (class method)
About Java String class
Java programming (class structure)
About java abstract class
[Java] Integer wrapper class reference
Java memo (standard class) substring
Java tips --StaticUtility class modifier
Java inflexible String class substring
(Note) Java classes / variables / methods
Java memo (standard class) length
[Java] Generics classes and generics methods
[Implementation] Java Process class notes
About Java class loader types
How to use java class
Check Java9 Interface private methods
[Java] Comparator of Collection class
Java class definition and instantiation
Java
Java learning memo (abstract class)
Java methods and method overloads
What are Ruby class methods?
Summary of Java Math class
[Java] What is class inheritance?
[Ruby] Class methods, instance methods, etc.
Java
Java abstract methods and classes
[Java basics] What is Class?
Create an immutable class with JAVA
About Java static and non-static methods
Why are class variables needed? [Java]
Call Kotlin's sealed class from Java
[Java] Object-oriented syntax --class method / argument
[Java] Memo for naming class names
How to disassemble Java class files
Kotlin Class to send to Java developers
StringBuffer and StringBuilder Class in Java
How to decompile java class files
[Java] How to use LinkedHashMap class
Various methods of the String class