help with arrays?
\[\begin{bmatrix} a & r& r\\ a&y&s\end{bmatrix}?\]
Given an array iArray of int type, declared to contain 50 elements, and a variable dVar of double type which has been assigned a value. Write an expression that assigns the value stored in the variable dVar to the last element of the array iArray.
arrays in java
sorry but i am yet to understand the language java
okay
You would have to convert the double value to an int first, so it can be stored into the array. double d = dVar; int i = (int)d; iArray [49] = i;
Understand?
iArray[49] = dVar;
You can't just store dVar into iArray because iArray is an array of int type, dVar is of double type. double d = dVar; //storing the value of dVar in d int i = (int)d; // using cast to convert double to integer iArray [49] = i; // storing the converted value into 50th element of array The first line may be unnecessary, I just like to simply things. You could also have done: int i = (int)dVar; iArray [49] = i; Of course this is assuming, the array iArray and variable dVar have already been declared.
thanks
i need with Echo command line...can you help me with that too?
public class EchoB { public static void main (String[] args) { System.out.println("Hello" + args[0] + " " + args[1]); }} What would be the output from this EchoB program if we invoke this program with the following command? java EchoB "How Are You?"
Assuming How, Are, You are 3 different arguments. The output would be "HelloHow Are" If it were: public class EchoB { public static void main (String[] args) { System.out.println("Hello" + args[0] + " " + args[1] + args [2]); }} The output would be HelloHow AreYou
Wow, I could have used this kind of help when I was taking a java course
can you still help ?
Please. I gave up on Java a long time ago. The next time I take a Java course, it will be with my personal tutor.
haha
go ask this in comp sci
Join our real-time social learning platform and learn together with your friends!