Answer:
1.ClassName and . operator
2. ClassName and [] operator
Explanation:
There are two ways to get the members of a class first one is by using dot(.) operator.
Example : with assumption that person is a class object and age is the member in it we can use it as:
person.age
Second way is to use [] operator with member as a string in it which is used by the compiler as key to get its value.
Example : person["age"]
Answer:
showProduct(int,double)
for example: showProduct(10,10.5) is the correct answer even showProduct(10,10.0) is also correct but showProduct(10.0,10.5) or showProduct(10,10) or showProduct(10.0,10) are wrong calls.
Explanation:
The code is
- <em>public static void showProduct (int num1, double num2){</em>
- <em> int product;</em>
- <em> product = num1*(int)num2;</em>
- <em> System.out.println("The product is "+product);</em>
- <em> }</em>
showProduct is function which asks for two arguments whenever it is called, first one is integer and second one is of type double which is nothing but decimal point numbers. Generally, in programming languages, 10 is treated as integer but 10.0 is treated as decimal point number, but in real life they are same.
If showProduct( 10,10.0) is called the output will be 'The product is 100'.
Strange fact is that, if you enter showProduct(10,10.5) the output will remain same as 'The product is 100'. This happens because in the 3rd line of code,which is <em>product=num1*(int)num2</em>, (int) is placed before num2 which makes num2 as of type integer, which means whatever the value of num2 two is given, numbers after decimal is erased and only the integer part is used there.
This is necessary in JAVA and many other programming languages as you <u>cannot</u><u> multiply two different datatypes</u> (here one is int and another is double). Either both of them should be of type int or both should be of type double.
Answer:
import java.util.Scanner;
public class ss11{
public static void main (String[]args) {
Scanner keyboard = new Scanner (System.in)
String a1, a2, a3, a4, a5;
int i1, i2, i3, i4, i5;
System.out.println("Enter a four bit binary number:");
a1= keyboard.next();
a2= a1.substring(0,1);
a3= a1.substring(1,2);
a4= a1.substring(2,3);
a5= a1.substring(3,4);
i1 = Integer.parseInt(a2);
i2 = Integer.parseInt(a3);
i3 = Integer.parseInt(a4);
i4 = Integer.parseInt(a5);
i1= i1 * 8;
i2= i1 * 4;
i3= i1 * 2;
i4= i1 * 1;
i5= i1+i2+i3+i4;
System.out.println("The converted decimal number is: +i5);
}
}
Explanation:
its a high spot being sanded im in auto body as well.
Answer:
A.
Explanation:
The malware that replicates itself and can infect the entire system is a worm.
A worm is a type of malware that gets self-activated and replicated. This worm spreads rapidly over the computer system and can corrupt all the files and the entire system.
A worm is a standalone application and does not require action from humans.
Therefore, option A is correct.