- 1

Java methods, statements, functions and class

ok im trying to figure out what order things go and if i have it right in my head. im assuming that "if()" or anthing that ends with "()" is a method which invokes things? String x = "hello world"; System.out.println(x); << is this a method within a statement? if so im assuming that a method is somthing that functions within a statement in a class? if thats right the function output would be "hello world"? or is the function the method? lol so confused 😕..

14th Jun 2017, 5:50 PM
D_Stark
D_Stark - avatar
2 odpowiedzi
+ 2
A class is like a blueprint for what will be instantiated into an object. It can contain properties (member variables), methods, and inner classes. Methods live inside a Class. Functions are basically the same as methods, but they stand alone outside of a class. Java doesn't have functions technically, but the terms method and function are often used interchangeably. class A { public void myMethod() { } } A Statement is basically a line of code. int x = 42; // statement declaring a variable System.out.println(x); // statement calling a method
14th Jun 2017, 6:06 PM
ChaoticDawg
ChaoticDawg - avatar
0
methods in oop are functions in a class
14th Jun 2017, 6:02 PM
Andrés04_ve
Andrés04_ve - avatar