Create non-static variables as below.
int score, balls, catches;
String player_name;
Create main method.
Inside main method, create two instances as below.
PlayGround player1 = new PlayGround("dhoni", 100, 3);
PlayGround player2 = new PlayGround("jadeja", 56, 2, 30);
Create appropriate constructors for handling above objects.
Using player1 object, call batting() method. Print - score, player_name.
Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.
Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.
Top comments (0)