We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 12: Inheritance
Day 12: Inheritance
Sort by
recency
|
1174 Discussions
|
Please Login in order to post a comment
Java Solution:
any advice on my code? can you make it better or even shorter?
Student class implementation with Python:
javascript
import java.util.*;
class Person { protected String firstName; protected String lastName; protected int idNumber;
}
class Student extends Person{ private int[] testScores;
}
class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String firstName = scan.next(); String lastName = scan.next(); int id = scan.nextInt(); int numScores = scan.nextInt(); int[] testScores = new int[numScores]; for(int i = 0; i < numScores; i++){ testScores[i] = scan.nextInt(); } scan.close();
}
****Python code*