Question & Answer: 31. Which of the following are the arguments in the following method? Employee emp new Employee0 erp.calculateSala…..

31. Which of the following are the arguments in the following method? Employee emp new Employee0 erp.calculateSalary(100000. 3.2.15): emp emp.calculateSalary(100000, 3.2, 15) O 100000, 3.2, 15 O calculateSalary (100000, 3.2, 15) 32. In Java, methods usually hold the properties of an object True O False 33. Youre designing banking software and need to store 10000 customer accounts with information on the accountholders name, balance, and interest rate. The best approach is store 30000 separate variables in the main method True O False 34. Methods allow all instance of a class to share same behaviors True ○ False 35. The import statement consists of two parts import package.dassName One is the package name and the other is the classname. True O False

31. Which of the following are the arguments in the following method? Employee emp new Employee0 erp.calculateSalary(100000. 3.2.15): emp emp.calculateSalary(100000, 3.2, 15) O 100000, 3.2, 15 O calculateSalary (100000, 3.2, 15) 32. In Java, methods usually hold the properties of an object True O False 33. You’re designing banking software and need to store 10000 customer accounts with information on the accountholder’s name, balance, and interest rate. The best approach is store 30000 separate variables in the main method True O False 34. Methods allow all instance of a class to share same behaviors True ○ False 35. The import statement consists of two parts import package.dassName One is the package name and the other is the classname. True O False

Expert Answer

 

Ans 31. 100000,3.2,15
Explaination:
 If we use a method within a class to do any operation upon number of variables. In this method if we wish to pass these variables from calling method to method definition then we use variables within method and pass them as arguments. In the given example method name “calculateSalary” is calculating the salary of defined values passed as arguments which are 100000,3.2,15.

Ans 32. True
Expalaination: Methods are used to define the behaviour of any private data member using which we gives functionality to the class of its data member.
Ex: class A{
private int a,b;
public int calc(){
return a*b;
}
}

Ans 33. False
Explaination: A least best approach is to implement a multidimensional m*n array where n can hold values more than 2 columns and m can hold values for more than 2 rows.
Other approach we can implement to achieve this can be structure, class, etc.

Ans 34. True
Explaination: Its true method delivers instances of a class to share same behaviours.
Ex: class Count{
private int a,b;
public work(){
a=10;
b=20;
}
public static void main(Sting[] args){
Count a1,a2,a3,a4= new Count();
a1.work();
a2.work();
a3.work();
a4.work();
}

}
Therefore, here “Count” class has 4 instances accessing the methods or behaviour named “work()”.

Ans 35. True
Explaination: As per the standard syntax of using a package:
import package.className;
package name is the set of classes in which we define a bunch of classes which we wish to be serve for particular purpose.
Ex: import java.awt.Graphics; By this we wish to access “Graphics” class defined inside the package “awt”.

Ans 36. *
Explaination:
 It becomes more easy and comforatable to use a wildcard ‘*’. As this wildcard ‘*’ is used to refer to all the present classes within a package and if we use a statement like “import javax.swing.*”, then here it means that we wish to access all classes present in javax.swing package.

Ans 37. True
Explaination:
 Whenever we write any program, we define our import statements as the first line after comments and after that we define our class and its relative properties. Compiler also looks at the first line of code to search for the import statements. If we place it after the class definitions, then compiler logs a error message with misplace import constuct.
An standard syntax to define import statements is:
//Comment section
import packageName.className;

class A{}

Ans.38.
import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.JFrame;
Explaination:
 If we wish to call all available classes within “javax.swing” package then “javax.swing.*” statement will allow to access all classes along with JFrame and JOptionPane. Also, if we import specifically like “import javax.swing.JOptionPane;import javax.swing.JFrame;” then it will access only these classes from swing package.

Still stressed from student homework?
Get quality assistance from academic writers!