Skip to content

Instantly share code, notes, and snippets.

@uncoded-ro
Created January 12, 2020 13:37
Show Gist options
  • Save uncoded-ro/274c76cb1bfabfb3fe33f0944b96b9e5 to your computer and use it in GitHub Desktop.
Save uncoded-ro/274c76cb1bfabfb3fe33f0944b96b9e5 to your computer and use it in GitHub Desktop.
class Cerc {
static final double PI = 3.14;
static int count = 0;
int x;
int y;
int raza;
// metoda constructor 1
Cerc() {
x = 0;
y = 0;
raza = 0;
}
// metoda constructor 2
Cerc(int x0, int y0, int raza0) {
x = x0;
y = y0;
raza = raza0;
}
// metoda non-statica
public double aria() {
return PI * raza * raza;
}
// metoda statica
static int nrObiecte() {
return count;
}
public static void main(String[] args) {
Cerc c = new Cerc(2, 5, 4);
System.out.println(c.raza);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment