Difference between method and function? [duplicate]

1

Because in Java it is called a method and in Kotlin it is called a function, it is just a different nomenclature, or is there any significant difference?

Java:

public class Teste {
    public static void main(String[] args) {
        int result = multiplicaDois(2);      
        System.out.print(result);
    }

    public static int multiplicaDois(int x) {
        return 2 * x; 
    }
}


Kotlin:

fun main(args: Array<String>) {
    val result = multiplicaDois(2);
    println(result);    
}

fun multiplicaDois(x: Int): Int {
    return 2 * x;
}
    
asked by anonymous 09.05.2018 / 14:34

0 answers