Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java call method from another class example

public class method{
  public static void sayHello(){
    System.out.println("Hello World");
  }
}
public class app{
  public static void main(String[] args){
    method m = new method(); // Creating an instance from our class
    m.sayHello(); // using the class methods by the instance we created.
  }
}
Comment

how to call a void method from another class in java

1_ you should first create an instance from this class.
2_ once you create one, you use it for calling the class methods.
Comment

PREVIOUS NEXT
Code Example
Java :: constructeur java 
Java :: java resto 
Java :: connecting to h2 database from java 
Java :: java enum values() 
Java :: composite design pattern 
Java :: java string start with substring 
Java :: resultset methods in jdbc 
Java :: java tamanho de um vetor 
Java :: java format double no decimal places 
Java :: taglib in jsp 
Java :: what to do in minecraft 
Java :: style jbuttons 
Java :: what are the chances that i pass this coming up test 
Java :: what is getService() in java 
Java :: java read from connection even if 404 
Sql :: mysql reset auto increment value 
Sql :: dbms_scheduler drop_job 
Sql :: continue in sql 
Sql :: mysql_secure_installation 
Sql :: mysql alter table add index 
Sql :: display all databases 
Sql :: postgres kill running query 
Sql :: cast string to datetime mysql 
Sql :: show max_allowed_packet mysql 
Sql :: oracle select first 10 rows 
Sql :: create table oracle 
Sql :: mysql where one year ago 
Sql :: oracle user last connection date 
Sql :: add column table sql default value 
Sql :: postgresql select all column names 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =