dev-resources.site
for different kinds of informations.
Cricket task
Published at
12/31/2024
Categories
java
programming
Author
hema latha
Main Article
- Create a class called Cricket
- Have below method in it. public int calculate(int balls) { return balls * 6; }
- Create one more class called 'Player1'
- Have main method in it.
- Now, create instance for 'Cricket' class.
- Using instance, call calculate() method with 10 as argument.
- Now, store the returned result as score.
- print the score.
public class Cricket {
public int calculate(int balls)
{
//System.out.println("gugan ball");
return balls * 6;
}
}
public class Player1 {
public static void main(String[] args) {
Cricket gugan = new Cricket();
int balls = gugan.calculate(10);
System.out.println(balls);
}
}
Articles
12 articles in total
Google project
read article
what is HTML ?
read article
HTML FIRST PROJECT TIME TABLE
read article
Assignment
read article
Assignment smart phone
read article
Assignment
read article
Assignments 4
read article
My Assignments
read article
Play Ground task
read article
Supermarket
read article
Employee task
read article
Cricket task
currently reading
Featured ones: