Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
public class Rectangle { private double width; private double height; public Rectangle(double width, double height) { this.width = width; this.height = height; } public Rectangle(double side){ this(side,side); } public Rectangle(){ this(1.0); } public double area(){ return width * height; } public double getWidth() { return width; } public double getHeight() { return height; } } public class Test { public static void main(String[] args) { Rectangle rect1 = new Rectangle(5.0, 3.0); Rectangle rect2 = new Rectangle(4.0); Rectangle rect3 = new Rectangle(); System.out.println("1-й прямоугольник " + rect1.getWidth() + "x" + rect1.getHeight()+". плошадь = " + rect1.area()); System.out.println("2-й прямоугольник " + rect2.getWidth() + "x" + rect2.getHeight()+". плошадь = " + rect2.area()); System.out.println("3-й прямоугольник " + rect3.getWidth() + "x" + rect3.getHeight()+". плошадь = " + rect3.area()); } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)