Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
43 views

java code to read table and pass values dynamically

I am trying to write java code where i would like to form a statement like "select * from ABC where DIFFERENT CONDITIONS" If there are DATE_START & DATE_END it should have SYNTAX "...
user10591810's user avatar
0 votes
1 answer
56 views

Java's advanced for loop not inputting captured values from nextInt properly

After initializing an array and using the For-Each Loop to capture 2 input values and update in the array, printing the values out results only in the last integer input showing, a zero. int[] ...
Ken Kiarie's user avatar
-1 votes
1 answer
72 views

Shuffle the Array - LeetCode problem. 2 pointers approach fails [closed]

I am trying to solve LeetCode problem 1470. Shuffle the Array: Given the array nums consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn]. Return the array in the form [x1,y1,x2,y2,...,xn,...
Abhishek Kumar Sharma's user avatar
-2 votes
0 answers
34 views

How to efficiently find and replace a substring in a string array in java? [duplicate]

I'm working on a java project where I need to find and replace a specific substring within each string in a string array. Here's a simplified version of my code: public class StringArrayReplace{ ...
Madhan Raj's user avatar
-2 votes
0 answers
70 views

Java code to pass values dynamically to SQL statement [closed]

Table values enter image description here enter image description here enter image description here Hi all, I am trying to write java code where i would like to form a statement like "select * ...
user10591810's user avatar
0 votes
2 answers
135 views

Can not create Function array in Java 8

I have a class called SFunction which extends from Function in JDK 8 @FunctionalInterface public interface SFunction<T, R> extends Function<T, R>, Serializable { } Now I have several ...
flyingfox's user avatar
  • 13.5k
-4 votes
0 answers
61 views

how to write this row mapper in better way [closed]

'm working on a Spring Batch application and have implemented a custom Partitioner to divide processing across multiple threads. I'm having trouble writing a JUnit 4 test for my partition method. I've ...
abhijat mishra's user avatar
0 votes
0 answers
80 views

Using arrays from different classes in java

I am making a TicTacToe game. The idea is I print a 3x3 grid with numbers from 1-9 and when a player selects a number it changes that element in the grid array with a character like * or o I'm facing ...
Coen Molyneaux's user avatar
-1 votes
1 answer
41 views

Array Index Out Of Bound Error for Finding an element in an infinite array by Kunal Kushwaha video

My Code public class InfiniteElement{ public static void main(String[] args) { int[] arr = {1, 2, 4, 6, 8, 9, 10 , 13, 16, 19, 20 ,23, 27, 40, 42, 44}; int target = 44; ...
UDAYA KRISHNAN.M's user avatar
0 votes
1 answer
60 views

Leetcode - Find the student that will replace the chalk

I tried the problem Find the Student that Will Replace the Chalk on LeetCode. There are n students in a class numbered from 0 to n - 1. The teacher will give each student a problem starting with the ...
Aprikose's user avatar
-1 votes
5 answers
128 views

How do I sort 13 random playing cards in order (sequence) in java?

I want to order 13 playing cards with order clubs, diamonds, hearts and spades, sequence 2,3,4,5,6,7,8,9,10,J,Q,K,A. For example 4C means "4 Club". I tried using the code below to order them ...
Dedetok's user avatar
  • 49
0 votes
1 answer
57 views

Non nested loop to find mode in Java

I got an assignment that my professor has given me the code but I have to fill the answers in the assigned line to complete the code I got with the fixed array in my problem but when I rearrange ...
doeeyes's user avatar
0 votes
2 answers
142 views

To modify the array so that all zeros are moved to the end while maintaining the order of non-zero elements [closed]

Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array. ...
Amar kumar Nayak's user avatar
0 votes
2 answers
75 views

unable to fill an array with numbers from input in java

I'm trying to set an array with desired length of numbers. It has to get the numbers from user but it throws an exception error after getting the first one. Can anyone help me to fix this please? ...
Nanika's user avatar
  • 21
-3 votes
0 answers
95 views

Returning a string vs returning an array in java [duplicate]

Consider below two code snippets showing java functions Snip 1: public String greet() { return "hello"; } Snip 2: public String[] greetings() { return new String[]{"hello", ...
Neha's user avatar
  • 1

15 30 50 per page
1
2 3 4 5
3496