Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
생성자
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_72 class Calculator{ int left, right; public Calculator(int left, int right) { this.left=left; // 전역변수 참조 this.right=right; } public void sum(){ System.out.println(this.left+this.right); } public void avg(){ System.out.println((this.left+this.right) / 2); } } class Rextester { public static void main(String[] args) { Calculator c1 = new Calculator(10,20); c1.sum(); c1.avg(); Calculator c2 = new Calculator(20,40); c2.sum(); c2.avg(); } }
run
|
edit
|
history
|
help
0
Wenfeng Ou
Pattern1
1.5
Odd
JAVA # Rastgele 15 sayıdan oluşan bir dizinin EK-EB ve Ortalamasını bulan Java Kodu
Coding Numbers - Polindrome
"encryption"
Hello, World!
Smallest Multiple of N with Zeros and Ones
1.5