All Questions
4,198 questions
-1
votes
2
answers
51
views
How to find each word in a 2D array from a specific ch
I'm new to Java and I'm trying to work this question out:
Write another method in the class (a suitable name for this method would be findChar). This method should take a char and a 2 dimensional ...
0
votes
4
answers
89
views
Building a string with array values
I have the following code which splits a string and gets the four values separated by a delimiter.
I want to build a result string like this:
/result = "<div class=\"parent\"> <...
-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 ...
-2
votes
5
answers
169
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 ...
0
votes
1
answer
97
views
Parsing a raw bytes through a string goes wrong in Java
I have problem with JTextArea, I just want to edit raw bytes (presented to String) from JTextArea, but some symbols have '?' character.
Firstly just for test, I wrote console program for test on ...
1
vote
1
answer
42
views
GUI Java Swing . Trying to get a string from one class into a jlable of another class
I'm trying to get an output from a bubble sort algorithm (which I'm currently doing with System.out.print) to be displayed in a JLabel in another class when I'm pressing a JButton.
I'm fairly new to ...
0
votes
1
answer
40
views
Logical Error in program while finding if string is Palindrome
This program to find if a string is a palindrome is not working properly due to logical errors. Pls help me correct this program.
public class Palindrome {
public String checkPal(String strr){
...
0
votes
0
answers
36
views
Java's split method work differently on different strings [duplicate]
I'm trying spliting strings by using String.split() method.
And when I use
String test = "a ";
String[] split = test .split(" ");
this array's length is 1.
But when I use
...
1
vote
2
answers
83
views
Finding the count of index in array of
How to find whether an array of string has only one index? I am trying with below piece of code but it is throwing index out of bound exception while the string contain only one letter.
class Test {
...
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://...
1
vote
1
answer
129
views
Change Charsequence array to String array or List<String> in Java
It should be simple but I couldn't find the easy one line answer. How can I change CharSequence[] to String[]. My goal is to change CharSequnce[]={"a","b","c"} to List<...
-4
votes
3
answers
60
views
search string through array
String a[] = { "a", "b", "c", "d" };
String str = "d";
for (int i = 0; i < a[i].length(); i++)
{
if (str.equals(a[i]))
{
System....
-3
votes
2
answers
77
views
Using string length to set up array [duplicate]
I'm trying to assign a number to each letter in a sentence depending on what letter it is.
However, when trying to set up the array using the String length it breaks idk why.
example
import java.util....
-2
votes
3
answers
74
views
How do i do this task right here?
In a file called PositiveMinMaxAvg. java, write a class with a main method that expects all the command-line arguments to be appropriate inputs to Double.parseDouble. It should print the average of ...
1
vote
1
answer
49
views
JTextfield.getText() not returning any value
I am relatively new to java, so i'm not the best at it. In my program, I have a board with an Array of JTextfields in which a player enters values and when they press the button, if it is a valid ...