Whats the purpose of inputted address inside []? [duplicate] - java

This question already has answers here:
How do I declare and initialize an array in Java?
(31 answers)
Closed 2 years ago.
Can i ask whats the meaning of the input "52" on [], because if i delete the 52 the program wont run.
ArrayList<String> playerCard[]= new ArrayList[52];

The 52 tells the compiler how large the array is.

Related

Kotlin : How to convert Array<List> to arrayof? [duplicate]

This question already has answers here:
Java ArrayList to Kotlin Array
(4 answers)
Closed 1 year ago.
So, I try to make a line chart using AAChartModel. I have ArrayList in my code. But in AAchartModel they used an arrayOf instead of ArrayList.
So My Question is, how do I convert from ArrayList to arrayOf ?
arrayOf() returns just an Array. So you can call arrayList.toTypedArray()

create 2-D character array in java [duplicate]

This question already has answers here:
Syntax for creating a two-dimensional array in Java
(13 answers)
Closed 3 years ago.
I want to create a character array like this one below:
character array
i am unable to find a method . Please help me out. Beginner in java
char[][] x = new char[][]{};
x[0][1] = 'c';
...

Correct way to instantiate an array in java? [duplicate]

This question already has answers here:
How do I declare and initialize an array in Java?
(31 answers)
Closed 5 years ago.
I am trying to declare and instantiate an array named 'canines' that had 25 elements and will hold 'dog' objects...
Is this the best way to do this or is there another formate that would be more correct?
canines[25] = Dog
Dog[] canines = new Dog[25];
Have a look at some of the many online java resources

how to use an array or an ArrayList with indices bigger than Integer_Maximum_Value? [duplicate]

This question already has answers here:
Is there a longer than int Java List?
(3 answers)
Using a long as ArrayList index in java
(7 answers)
Closed 7 years ago.
I want to have a big ArrayList, so its index would go beyond int, how or what can I use for that?
I already checked that Vector does have the same issue, any ideas?

How to Make Java Recognize A Zero [duplicate]

This question already has answers here:
Best way to Format a Double value to 2 Decimal places [duplicate]
(2 answers)
Closed 7 years ago.
The title says it all. Right now if I input a number like 100.50, in my program it prints as 100.5. Is there an easy way to make the program recognize the zero?
You can do this trick.
String s = String.format("%.2f", 100.50);

Categories

Resources