Skip to main content

All Questions

Tagged with
-1 votes
2 answers
104 views

Making a Histogram using an Array of integers

I’m trying to make a method that takes a String and then fills an array based on the frequency of letters in the string where the array[0] is the number of A’s etc. Then it takes the array and prints ...
BetaChad's user avatar
0 votes
1 answer
54 views

Difference of outputs of print of int[] ,String[] and char[] in Java

My question is simple .I know output but i can't know why is different outputs of all of them. Firstly, i wanted to get output of array what is created newly and is empty .i coded like that: (https://...
The Best's user avatar
0 votes
0 answers
123 views

Integer - Cannot pass int[] in an Integer[] method

I am trying to take a few steps back and work on some simple math functions like vectors just for fun (So technically I'm not in search of any library). I wanted to add a feature where you can pass an ...
user avatar
0 votes
1 answer
256 views

Char array is directly printing the contents of the array without requiring me to specify the index positions, it is great but how is this happening? [duplicate]

Char array is directly printing the contents of the array without requiring me to specify the index positions, it is great, but how is this happening? Can someone please explain me what's happening ...
Swapnil Mishra's user avatar
-3 votes
2 answers
63 views

How do I add to the value of an integrer?

For a school assignment in Java, we're pretending to code the meny at a Spa Reception where the customer is supposed to add which treatments they've chosen and it's supposed to be added to the total ...
quasireal's user avatar
3 votes
3 answers
781 views

Leetcode 2161: Partition array according to given pivot

I'm currently solving LeetCode problem 2161. Partition Array According to Given Pivot: You are given a 0-indexed integer array nums and an integer pivot. Rearrange nums such that the following ...
Some Name's user avatar
  • 9,570
-2 votes
2 answers
646 views

Why does it output -294967296 [duplicate]

So in leetcode 4 sum there is a test case [1000000000,1000000000,1000000000,1000000000] and for some reason the addition of these is equal to -294967296 and i do not understand how exactly this works ...
skeleg's user avatar
  • 21
-2 votes
2 answers
150 views

removing an element from an array using ArrayList(java) [duplicate]

I am trying to remove an element from an array using ArrayList. however I cannot seem to get it to work. I'm new to java. Here is the code what i do package workspace; import java.util.*; import java....
Amalshanth's user avatar
0 votes
2 answers
126 views

Converting array into integer, but the integer is giving garbage value when more than 9 digits are added in it

So I was doing a question on leetcode in which an integer was in an array form with its digit in left to right. I wrote the following code to convert the input array into integer. But when 9999999999 ...
Mohit Yadav's user avatar
1 vote
2 answers
414 views

java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Ljava.lang.Integer; Concatenate/Merge/join two Integer[] Array

I'm trying to concatenate/merge two Integer[] array and store it in an other Integer[]. But I'm getting bellow error at run time. Exception in thread "main" java.lang.ClassCastException: ...
S14321K's user avatar
  • 230
1 vote
1 answer
63 views

Transfer all numbers from an Array into another in Java

I have a list that is holding multiple numbers in the same index, with all but the last number separated by a comma. I'd like to get all these numbers and transfer them to an array, but I want all ...
luan_navarro's user avatar
-2 votes
1 answer
97 views

How to create array from elements from another file in Java [duplicate]

my coursework so I want to create an array each for the score of flyweight and featherweight. but i have no idea how. this is my code so far Scanner readFile = new Scanner (Main.class....
aurellia's user avatar
-1 votes
2 answers
122 views

How to print these specific elements of the array?

I am practicing how to print specific elements of the array. The output should be Elements in the array: -5 -3 -1 1 3 5 7 9 -2 0 2 4 6 8 10 12 1 3 5 7 9 11 13 15 4 6 8 10 12 14 16 18 7 9 11 13 15 ...
New starters's user avatar
0 votes
1 answer
285 views

How to replace all even elements in an integer array with a special symbol '$' using java

We have an integer array and all even numbers in that array must be replaced by "$"; Here is my code : int[] array = {1, 2, 3, 4, 5, 6}; char specialChar = '$'; for (int i = 0; i < array....
Arya V L's user avatar
  • 341
0 votes
2 answers
33 views

Why does my CalcOddIntegers method always return zero?

This method is supposed to take user input for the length of the array, and then the integers that are part of the array, and return the amount of odd numbers in the array. However, it always returns ...
KodaNotABear's user avatar

15 30 50 per page
1
2 3 4 5
63