Most voted "java" questions
Use this tag when the question refers to some resource, information, or problem relating exclusively to the Java programming language. Java is a class-based, statically typed, reflective, and execution environment (JRE) language. Java programs are compiled to bytecode and run on a virtual machine (JVM), allowing a "write Once, run Anywhere" philosophy (WORA).
Learn more…14,468 questions
Sort by count of
-
-2
votes1
answer609
viewsMVC Dao - How Do I Separate DAO from the Control Class?
1-My DAO is inside the Control Class, as I do to separate it in a Daobairro? 2-The Connected Bank has Factory Standard (Connection Factory)? Details here, with the codes:…
-
-2
votes2
answers3257
viewsHow to remove a part of a string?
I have a text saved in a string and need to copy a part of that text to find a certain word in it. Ex. I need to remove my name and my age from this text, I know they always come after : and in…
-
-2
votes2
answers1391
viewsCheck if the program is running on Windows
Good night. I was wondering if you could give me a JAVA example of how to check if my program JAVA-MADE is running on Windows. Taking advantage of the topic, I would also like to know how I execute…
-
-2
votes2
answers39
viewsScalate a value in a given range
My programming teacher asked this question and I couldn’t understand why I have to use one of these formulas to scale the temperature. And I couldn’t identify the right answer either. You have the…
-
-2
votes3
answers1141
viewsHow to create an element search method in an Arraylist?
Assuming an Arraylist that stores objects, and these objects have attributes of various types (int, String , float, etc...). Knowing this I want to create a method to find an object in Arraylist…
-
-2
votes1
answer24
viewspass objects from one class to another
I have the following objects in the Game class as I call these objects in the class Main? team1=new Team(t1, t2, t3); team2=new Team(e1, e2, e3);
javaasked 7 years, 5 months ago Music Lyrics HQ 63 -
-2
votes1
answer62
viewsProblem picking up a GSON variable
I’m making an app that uses the google maps Directions api, which returns me a json, for example: { "geocoded_waypoints" : [ { "geocoder_status" : "OK", "place_id" : "ChIJeRLP8gx3GZURImtwaSWGJgY",…
-
-2
votes1
answer55
viewsAre API Components in the aws package?
I have the following question. And yes, it contains "aws" instead of "awt", but I think the correct one would be "awt". Are API Components in aws package? I - Panel II - Label III - Windows IV -…
-
-2
votes1
answer145
viewsJava and JSON API
I wonder if anyone knows a good API and tutorials to create, edit, write and read JSON files in Java. I’ve been researching for some time and so far I haven’t found.
-
-2
votes1
answer771
viewsHibernate with Java 9
I have a personal project using Hibernate with java 9, and it doesn’t seem to run at all! Follow the error: log4j:WARN No appenders could be found for logger (org.jboss.logging). log4j:WARN Please…
-
-2
votes1
answer52
viewsHow to open txt in java for user
I create a txt and can read too but how do I open it for the user as if I clicked on it? it can be by the same notepad or make it select the program...
javaasked 7 years, 3 months ago Caio Henrique 1 -
-2
votes1
answer456
viewsError creating Maven project in Eclipse
The error happens as soon as I create the Maven project, I use the Eclipse Oxygen.…
-
-2
votes2
answers1198
viewsAny IDE like Android Studio?
I am learning Java, and I am highly recommended to Android Studio. My Notebook is a Core i3 with 4GB ram, I was also told that with 4 ram is almost impossible to try to work with java. Is that true?…
-
-2
votes2
answers156
viewsjava.lang.nullException error
I am developing software for a video rental company with Pattern MVC (Model-view-controller) design with the Java Persistent Api Framework and the XML (Generic Markup Extensible Language). My…
-
-2
votes1
answer126
viewsDrawing of positions of a matrix
I need to create a function to draw within a matrix full of 0 with size n x n, four positions to modify the value only of these drawn positions.
-
-2
votes1
answer815
viewsCall method with parameter of another method in Java?
I would call a method with parameter being an object of another class, but this object is created in a previous method? Example: Classea: Public void cadastrar (Cliente cliente){ System.out.println…
javaasked 6 years, 11 months ago Caio de Souza 41 -
-2
votes1
answer166
viewsHow to convert Scanner to double in java?
I am developing a software, in which at a moment the system must take a value informed by the user using the Scanner class and insert it into an array and then return an array with the values typed…
javaasked 6 years, 11 months ago Marcos Paulo S. Rezende 351 -
-2
votes1
answer1903
viewsjava.lang.Noclassdeffounderror: Could not initialize class com.ailson.mavenproj.factory.Jpautil
I am having a simple insertion into the java web database using JPA, Hibernate and Maven. The problem is that error is appearing java.lang.NoClassDefFoundError, and I can’t see where the bug is.…
javaasked 6 years, 11 months ago Ailson Delgado 11 -
-2
votes1
answer314
viewshow to terminate the input when using . hasNext() in java?
I’m using a code that uses Scanner (I named after input) and uses while(input.hasNextLine()), but he keeps asking for input, I know he has a specific command for it (something like /n) but I can’t…
javaasked 6 years, 11 months ago Andrade Lucas 19 -
-2
votes1
answer64
viewsConfiguration of Hibernate
I am in a web java project, using Hibernate, Maven, jsf, SGBD postgreeSQL and the apache Tomcat container, and now I am using the Hibernate configuration file (cfgConfig.XML) and would like to…
-
-2
votes1
answer692
views -
-2
votes1
answer548
viewsError while building and running the project, java web, with jpa and Hibernate
I am developing a Java Web project, using JPA, Hibernate and Maven, and when running the project, or when building the project I get the following exception: cd E:\NetBeansProjects\mercadinho;…
-
-2
votes1
answer184
viewsNullpointer Java Even if you initialized the variable
i am having a problem to set a label of another controller, my project is structured as follows: Filmeoverviewcontroller, is the Overview that contains a tableview, in that tableview you can select…
-
-2
votes1
answer259
viewsWhat is the difference between Mkdir and Createnewfile?
I’m studying about the class File in Java, and would like to know the difference between using the mkdir and the CreateNewFile, the mkdir creates the directory that is passed as parameter in folder…
javaasked 6 years, 10 months ago Caio de Souza 41 -
-2
votes1
answer99
viewsError database.Cursorindexoutofboundsexception: Index 0 requested, with a size of 0
The following error is occurring in my application and I am not able to solve it. Could you help me ? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.sala304b.padariacoimbra, PID: 15159…
-
-2
votes1
answer496
viewsHow to check if a file has been added to a java directory?
I need a program in Java, check if in a directory was added some text file. Could someone help me ?
-
-2
votes1
answer114
viewsFor - loop loop
Hello, I am new here and in the world of programming. I would like to know how to do the last part of this exercise using For. So far I have done this: for(int i = 1; i<=100; i++) { if(i%2==0) {…
-
-2
votes1
answer64
viewsHow to get a specific field of a class even though it is inherited
I am facing problems while trying to get a field of a class, I am always getting the error NoSuchFieldException. What is known is that this field is inherited and deprived of another class, but the…
-
-2
votes1
answer611
viewsHow to check if a field of an array of chars is empty in Java?
I am trying to check whether a particular position of an array of chars actually contains some character. I tried it two ways: char[] arr = new char[10]; if(arr[0] == null){ } And also: char[] arr =…
-
-2
votes1
answer133
viewsError updating package in Gradle project
In a Gradle project, there was a need to update build.grade to another format which caused an error: build.Gradle /* * This build file was generated by the Gradle 'init' task. * * This generated…
-
-2
votes1
answer50
viewsError while running Servlet
While running my project. I received an error message. Tomcant is running and I have a contact class and a contact server. Code contact package com.dev; import java.util.Date; public class Contato {…
-
-2
votes1
answer79
viewsInsert n points of a vector randomly into any matrix in java
I’m beginner in java, I was wondering if there is any function that would facilitate my life so that: having a vector of n positions filled with (pre-defined) numbers, distribute these numbers at…
-
-2
votes1
answer100
viewsHow to implement an inputText for "Tags" or "keywords" in Android Studio?
I am creating an android app and need a simple inputText that allows the user to type "tags" very similar to the field of questions here on the site. How do I implement this? Do I need some external…
-
-2
votes1
answer125
viewsDo I need to download JVM to run a java program on my PC since I’m not a developer?
Do I need to download JVM to run a java program on my PC since I’m not a developer, that is, I will only need JVM to run this program? Better yet, how do programs made in java run on people’s…
-
-2
votes2
answers153
viewsHow to put 2 loop inside a list? or a second loop to a second list
This is a program that checks between 1 to 100 which numbers are divisible by 3 and also counts their amount, all on top of this formula: a=n*n; b=a+?; This interrogation is where I wanted to loop…
javaasked 8 years, 8 months ago William Karl 5 -
-2
votes1
answer116
viewsConvert Cell to String type in Apache POI
How can I convert a guy Cell for String ? String datateste = row.getCell(5);
-
-2
votes1
answer49
viewsCall conversion from Java to Kotlin
I’m creating an app that will have a main Activity and some interspersed Fragments, in this case I’m trying to release a fragment_main but I can’t get this Java code to become Koltin code:…
-
-2
votes1
answer65
viewsJava Web with Primefaces and Hibernate
I have problems with the Primefaces Dialog. I have a Dialog that will appear when I click on a commandButton, in the oncomplete method, of a datatable. This Dialog will have another datatable that…
-
-2
votes1
answer121
viewsError of Parsing
I wrote the code below: import java.lang.Math; import.util.Scanner; public class HelloWorld { public static void main(String[] args) { int y; int cont; int i; Scanner x = new.Scanner(System.in);…
javaasked 8 years, 7 months ago Filipe Teixeira 37 -
-2
votes1
answer4784
viewsException error in thread "main" java.lang.Nullpointerexception
So I’m trying to make a program that adds 2 vectors via Thread, but he makes the following mistake: Exception in thread "main" java.lang.Nullpointerexception At Soma. (Main.java:37) At…
-
-2
votes1
answer116
viewsI need a function to return true or false, depending on the amount of letters
boolean b = mascara.matches("\\D{0,4}"); I need a mask (like for example "GHO-1A23") is verified to contain only 4 letters. If you have 4 type only number and if you have less than 4 let type one…
-
-2
votes1
answer49
viewsIs it possible to call a class(Jframe) by pressing ok on Joptionpane?
I would like to open another window by pressing ok on Joptionpane is it possible ? if Yes ! give me a Light ?
javaasked 6 years, 5 months ago Lucas Ribeiro Vacilloto 1 -
-2
votes1
answer69
viewsList Sorting in Java
If Collections.sort(lista); sort the list ascendingly, which command can I use to leave a list in descending order?
-
-2
votes1
answer86
viewsWhat is the difference between the Join() method and the Synchronized statement?
I’m having trouble knowing the difference between the method Join() and the modifier Synchronized.
-
-2
votes1
answer31
viewsQuestion about using Hashmap
I have a question about the use of Hashmap of Java. On this occasion, I have a class with the attribute Hashmap custo. In this class, I need to create a builder and in this builder, I need to…
-
-2
votes1
answer59
viewsHow to compare numbers in vector list?
I have an integer vector list in java (Arraylist Listvet). public static ArrayList<Integer> ListVet; And I need to make a comparison between two numbers from that same vector list. So, I did…
-
-2
votes1
answer277
viewsWays to instantiate a Java String
What is the difference between these two ways of instantiating a Java String? String x = "y"; String x = new String("y");
-
-2
votes1
answer1256
viewsSIMULATE CLICK ON A <a href via SELENIUM WEBDRIVER
I am walking through a TABLE in the last column I have a link that opens an Alert, but I am not able to simulate the click with Selenium, if someone can help me? td class="aligncenter"> a…
javaasked 6 years, 4 months ago João de Lima 33 -
-2
votes1
answer25
viewsDraw between Activities
Good afternoon, I was wondering how do I choose a maximum number in one Activity and the other make a draw with the maximum number being the one chosen in the first Activity
-
-2
votes1
answer84
viewsProblem removing data from an Arraylist
Good afternoon, I am having a certain difficulty in reading and writing the data in an arraylist. The data from my TXT file: Mark 12345 Rafaela 54321 Kaique 12345 Matheus 54321 Just follow my code:…