This main class implements two classes NFA player and NBA player. Generate a JUnit test case for the following main.java class. Main.java public class Main { public static void main(String[] args) { NBAPlayer nbaPlayer = new NBAPlayer("Jimmy",123,"Basketball"); System.out.println("Name of NBA player is "+nbaPlayer.getName()); System.out.println("Stats NBA player is "+nbaPlayer.getStats()); System.out.println("Sports of NBA player is "+nbaPlayer.getSport()); NFAPlayer nfaPlayer = new NFAPlayer("Andy",231,"Baseball"); System.out.println("Name of NFA player is "+nfaPlayer.getName()); System.out.println("Stats NFA player is "+nfaPlayer.getStats()); System.out.println("Sports of NFA player is "+nfaPlayer.getSport()); }
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
This main class implements two classes NFA player and NBA player.
Generate a JUnit test case for the following main.java class.
Main.java
public class Main {
public static void main(String[] args) {
NBAPlayer nbaPlayer = new NBAPlayer("Jimmy",123,"Basketball");
System.out.println("Name of NBA player is "+nbaPlayer.getName());
System.out.println("Stats NBA player is "+nbaPlayer.getStats());
System.out.println("Sports of NBA player is "+nbaPlayer.getSport());
NFAPlayer nfaPlayer = new NFAPlayer("Andy",231,"Baseball");
System.out.println("Name of NFA player is "+nfaPlayer.getName());
System.out.println("Stats NFA player is "+nfaPlayer.getStats());
System.out.println("Sports of NFA player is "+nfaPlayer.getSport());
}
Step by step
Solved in 2 steps