A
A
Asya2016-03-20 18:59:19
Java
Asya, 2016-03-20 18:59:19

How to compile a class in Java?

package ru.ncedu.java.tasks;

public interface Employee {
  
  int getSalary();
  
  public void increaseSalary(int value);
  
  public String getFirstName(
      String name
      
      );

  public void setFirstName(String firstName);

  public String getLastName();

  public void setLastName(String lastName);

  public String getFullName();

  public void setManager(Employee manager);

  public String getManagerName();

  public Employee getTopManager();
}

Here I have the following code, when I click run, nothing happens:
ee799ee5629443dcb1277c50df51b5ac.jpgf2d8de74062c40188218669e8e122554.jpgf9d041110dee4325a238ca6b1f631b6e.jpgwhat should I do to make the code compile?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Zagaevsky, 2016-03-20
@asyaevloeva

You need to create a class, for example Main, and create a main method in it:

public class Main{
    public static void main (String[] args){
    // тут код, который будет выполняться
    }
}

And then it can be run as a Java Application.
And you have created an interface.

D
Dmitry Richter, 2016-03-20
@followthemoney

Look, this is your interface, as you said, create an empty class for a start, then do

public class MainActivity implements НазваниеТвогоИнтерфейса{
after which the methods from your interface can be added to the main class and overridden already (do whatever you want with them).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question