Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [java]

Java (not to be confused with JavaScript, JScript or JS) is a general-purpose, platform-independent, statically typed, object-oriented programming language designed to be used in conjunction with the Java Virtual Machine (JVM). "Java platform" is the name for a computing system that has installed tools for developing and running Java programs. Use this tag for questions referring to the Java programming language or Java platform tools.

Filter by
Sorted by
Tagged with
0
votes
0answers
2 views

Getting java.net.ConnectException while connecting to remote host through a jump host

Trying to use JSch to transfer files to a remote host but that has to be connected through a jump host. I can connect to the jump host but got exception while trying to connect to remote host. I ...
0
votes
0answers
4 views

Neo4j OGM Unable to process ZonedDateTime field on class my.class.Class. Check the mapping

I am trying to persist a @NodeEntity which has a field of type java.time.ZonedDateTime into my Neo4j database using the Bolt driver, but all I get is this warning message: org.neo4j.ogm.context....
0
votes
0answers
10 views

Iterate the list within list and collect it as list

Below is the kafka message dto: public class KafkaMessage { private String guid; private Long timeStamp; private boolean booleanValue; private Long longValue; private Float ...
-5
votes
0answers
16 views

Is there a website or software that can take input and output a specific string of formatted text? [on hold]

def unlock_doc (): u = input("caller/ requester?: ") a = input("Analyst Full Name?: ") s = input("Server?: ") db= input("database?: ") dn = input("document number?: ") v = input("version number?:...
-2
votes
2answers
13 views

How to make my sum method, which uses a for loop on a list, work correctly?

I am writing a program to calculate GPA and print a transcript. I am having some issues with the methods I have created to get the sum of a semesters gpa. Here's relevant code: double sumGP; ...
0
votes
4answers
17 views

How can I recode this nested for loop counting box?

The goal of this assignment was for me to create a nested for loop that prints: 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6 While I have attempted the code myself on java, I was informed there was an issue. I ...
0
votes
0answers
7 views

Build option in intellij will be grayed out when opened the project

I am new to Intellij. When I open my project, it takes hell lot of time for my build options to be enabled. When I select debug option, in the background task build task will be running but with not ...
0
votes
2answers
21 views

How to write a conditional statement that chooses between three colors to produce a specific image

I'm doing a lab for a Computer Science course I am taking in university. The problem states, "Have each return an int representation of a Color. Also have each accept four int parameters: a column ...
0
votes
0answers
6 views

How to convert content like “/document/image:7196” to a real path

I want to convert the string like /document/image:7196 to the real path like document/image/picture1.png. how to make it this bellow what i've done intent = new Intent(Intent.ACTION_GET_CONTENT); ...
0
votes
0answers
8 views

Building brick breaker but I'm not sure how to check collision with the ball and paddle

Right now I have a code that works most of the time but my ball sometimes does not collide with the paddle or it goes directly through it and then gets stuck and disappears. It also sometimes will get ...
1
vote
0answers
10 views

Java Text Field Input Issue

So I'm trying to have users type in an answer to the question via a text field, but the way I have it set up, the name field is only being stored inside the ActionListener Class and not the QName ...
0
votes
1answer
12 views

How to save lines from a text file using buffered reader

So I have a text file that has some info about courses such as course CRN, course full name, course description, course credits. And there are many more courses like this in the file in lines of 4 ...
0
votes
0answers
7 views

SWT GC Remove color outside circle

I want to keep the color inside the circle and remove the color outside the circle. Does anyone know how to do that using SWT GC?
0
votes
0answers
7 views

How to create a collapsible/expandable view/activity android?

I uploaded video on YouTube so that you can see exactly what I intend to achieve: https://youtu.be/Z8ga296UqtM I am pretty sure that this is a View. But I have no idea how can I implement ...
0
votes
0answers
7 views

Live stream USB sensor camera which not suported by UVC standard

I have a problem when trying to live stream the USB sensor camera which not supported by UVC Camera standard. The Sensor Camera displays a green screen when I using the Afroge.Video.Directshow in C# ...
0
votes
1answer
19 views

How to add java.util.Scanner class to read two-dimensional array of float entries input?

I have a question about using java.util.Scanner class to read two-dimensional array of float entries input, I've tried to find on internet, but still can't work. The code show me errors. Anyone can ...
0
votes
3answers
20 views

Why is the first element in the array being assigned a value of 0.0? NOTE: Not asking about INDEX, talking about value

This is a high school assignment. In my first for() loop, I build an array based on user input. However, the first value of the array is skipped and set to 0.0 I have traced the code through and ...
0
votes
1answer
17 views

Player position in array

Why is my Security ('S') in the same position as Donald ('D'). The map should be printing out like this [D - - - -] [- - - - -] [- - - - -] [- - S - -] [- - P - -] But instead it shows up like ...
0
votes
0answers
7 views

How to instantiate an @Interface (annotation class) in Kotlin? [duplicate]

I have this Annotation @interface MyKey { String name(); Class<?> implementingClass(); int[] thresholds(); } In Java, I could instantiate it in Java. final class ...
-2
votes
2answers
27 views

how to search that List<strings> contains all values of given arrays[] of string using stream?

I have a list of movie Objects that contains title, producers, directors, actors and release year. I need to find which movie is directed by given director(s). then store all found movies in a map ...
0
votes
0answers
7 views

how to convert result from CompletionStage

I access an API and I return result is success, but I want to convert result to variabel integer, when I try it it show error " cannot convert from completionStage to integer" WSRequest req1 = ws.url(...
0
votes
1answer
13 views

IntelliJ IDEA 2019 runs Java 11 (when building Gradle project) even though every option set to Java 8?

When attempting to import a Gradle project, I receive the following error: Cannot determine classpath for resource 'java/sql/SQLException.class' from location 'jrt:/java.sql/java/sql/SQLException....
0
votes
0answers
8 views

How to make a high resolution marker icon in Android Studio 3.5 map

I have tried different icons in png formats(icon.png) with this option - markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon)); and always the icon is in low resolution not like ...
-1
votes
1answer
28 views

Decimal places in Java [duplicate]

I am trying to get a number value to output with 2 decimal places, even if either of them are zero. I have read this post: Formatting decimal places in Java and I haven't been able to fix it. This ...
0
votes
0answers
20 views

Printing first and last name from first name, last name to last name, first name

public, static method called formatName. This method should accept a String called name that contains a name in the format "First Last". You may assume that there is only one space in the String. The ...
-1
votes
2answers
28 views

how do you “transfer” classes in java?

i'm trying to "import" (i don't think thats the right term though.) a class, from a class, with/via IF statements. what syntax should i use? i tried using import package.testclass, but i dunno what ...
1
vote
0answers
25 views

Developing SQL queries safely in Java

How do I develop multiple SQL conditions, and subsequently incorporate these conditions into a query along with the order by clause safely ? I'm trying to write SQL statements with potentially ...
0
votes
1answer
18 views

How to query SQLite table based on 2 arguments?

I am trying to query my SQLite table based on 2 columns which equal the values of a jList and jtextfield. I have set a ListSelectionListener to wait for which "date" is selected from the list. I know ...
0
votes
0answers
3 views

how to get java codes after using react native bulid a complete app?

In react native android JS code will be translated to java code, so can I have some way to get this code?I searched android's fold, but can not find. Can u give me some advises?
0
votes
0answers
7 views

Java FXML GridPane.getRowIndex(source) returning null always when handling mouse event in Scene Builder

I am new to Java FXML. I am still learning how to use Scene Builder 2.0 and controller classes. I don't understand why this is returning null @FXML public void gridClick(MouseEvent e){ Node ...
-2
votes
0answers
11 views

Exception in thread “main” java.lang.ClassCastException: ArrayList cannot be cast to java.util.List with this code?

import java.util.Iterator; import java.util.*; public class SortArray { public static <T extends Comparable<? super T>> void selectionSort(T[] a, int n) { for (int index = 0; index &...
0
votes
0answers
7 views

Read and write ROOM database SYNCHRONICALLY everywhere

I have been analyzing the way of reading and writing a ROOM database SYNCHRONICALLY without the need of a Content Provider or BroadcastReceiver. Obviously the database access must be asynchronous. I ...
0
votes
1answer
9 views

Java Intellij class diagram

How can I show class diagram via java intellij?, I can't run simple Uml plugin. my intellij version : 2019.2
0
votes
1answer
24 views

Can you help me with my Assignment? While Loop is running indefinetly and not giving the right Output

I'm just starting out in Java 8 so please excuse my horrendous code. After a few hours of trying I'm still not getting any actual results. The given problem is: ABC + DBE = EFF minus minus ...
0
votes
0answers
9 views

how to save a list of objects in Realm Android?

I want to save an object that has a list, the problem is that when I add the list it shows me an error this is the object: public class SaveRealm extends RealmObject { private String id; ...
0
votes
0answers
15 views

How can I fix my if loops, so they actually are executed? [duplicate]

This program takes user input, prints a trasnscipt, and calculates gpa for semester and total. It is all working correctly so far (there are three other classes not visible). Except my condition on ...
0
votes
0answers
18 views

What are the downsides of passing a class logger between Classes in Log4j

Let's say I have a Class A that creates a class logger. Then Class A calls an instance of Class B. If I were to pass Class A's logger into Class B and then Class B logs using the parent logger what ...
0
votes
0answers
12 views

ChannelSftp performance slow when getting files in directory tree

I have a function that gets all files in an SFTP working directory /** * This method gets the details of all the files from the working directory path and beyond * @param channelSftp of type ...
0
votes
0answers
18 views

How do I use java stream to filter on a list of objects by a property of the object and then collect the filtered objects into a list of new objects? [duplicate]

I need to filter on a list of objects where the object id equals a certain id and then I need to collect the filtered objects in a new list. Here is what I have so far but it returns nothing despite ...
0
votes
0answers
18 views

Resolving NoClassDefFoundError: java/lang/StringConcatFactory issue

I have the following error: java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: java/lang/invoke/StringConcatFactory It is difficult for me to show code as it results when I make a call ...
0
votes
2answers
38 views

Calling a method with a for loop inside, not updating variables

I am creating a bookstore for a lab in my computer science class. It uses three classes that interact with each other to create a bookstore that adds books, sells books, displays the library, and so ...
-1
votes
2answers
23 views

Java Blackjack program creates error: non-static variable this cannot be referenced from a static context [duplicate]

I am trying to create a solution to this problem: " Have the function BlackjackHighest(strArr) take the strArr parameter being passed which will be an array of numbers and letters representing ...
0
votes
1answer
28 views

Making a method to find lower case letters in a string

public static boolean hasLower ( String text){ char c; System.out.println( "Enter Text Here: : "); c = scan.nextChar(); for ( int i = 0; i < text.length(); i++){ c = text.charAt(i); ...
-1
votes
3answers
52 views

finding duplicates using java 8 [duplicate]

I have an employee class with id, name and address fields. Two employees are considered the same if their id and name are exactly same. Now I have a list of employees, now my task is to get the ...
0
votes
2answers
19 views

Create list of certain size in Java from SortedSet

I've a SortedSet of TreeSet implementation, which I often convert to list via new ArrayList<>(mySortedSet) and then do subList(myList, 3) or any other number of elements. How can I avoid using ...
-2
votes
2answers
25 views

Why do i keep getting Exception in thread “main” java.lang.ClassCastException: ArrayList cannot be cast to java.util.List with this code?

public static <T extends Comparable<? super T>> Interval findInterval(Integer[] a, List<T> targetValues) { T maxValue = findMax(targetValues); T minValue = findMin(...
0
votes
1answer
17 views

How to make number result without decimal

I have problem with code. I will copy simplified code, with two editext and one textview and button. With this code if value in editext1 is "100" and other editext2 is"60" I get result answer "40.0" ...
0
votes
1answer
18 views

Returning a 2-Dimensional Array from a method

I'm trying to return a 2-dimensional array from a function inside of a class. I don't want to create a new array inside the function because I want to return the same one I've passed into the function....
1
vote
0answers
10 views

AVL Tree Rotation Conditions

I'm studying for a mid term about different tree algorithms like Binary trees, AVL trees, etc etc. The exam isn't so much about how to write the code but what happens when you're trying to fix the ...
0
votes
2answers
31 views

Program doesn't properly Write / Read file when executed

I have a program that is supposed to write stuff into a file and then display the same file at the end of the program. I have a smaller test program that does the same thing and it works, but the ...