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
-
5
votes2
answers6555
viewsHow do I check if two strings are anagrams of each other?
I need to buy two strings and check if the second one is an anagram of the first one. I thought I’d use FOR repeat loops. I think you should first check if both are the same size, then go through…
-
5
votes1
answer9847
viewsHow to create string vectors in java?
"Make an algorithm to receive an integer n (number of students), an integer m (number of subjects), and nxm grades from 0 to 10, which each student obtained in each discipline. Present: a) which (or…
-
5
votes1
answer211
viewsWhat justifications/implications for the removal of Permanent Generation?
I could observe that in "Java Hotspot Performance Engine" 8 Permgen has been removed, but what was the motivation for this and where was it relocated? Is there any implication in this, for example,…
-
5
votes3
answers1630
viewsMount a single string with multiple strings from a Java Arraylist
How can I take several Strings of an Arraylist in a simplified way and join in only one String type variable? I’m new to Java and I’m having difficulty completing this change in a simplified way,…
-
5
votes1
answer608
viewsJVM. What is the difference between Metaspace and permgen?
What is the difference between Metaspace and permgen? I’ve been trying for a while to understand, I could help?
-
5
votes1
answer551
viewsHow can I create a 20-number Bet Card look in Jframe
It is a game where your bet will be competing to Sena, Quina and Quadra, so each bet can only have 6 numbers, I need the user to select 6 numbers from these 20 and then I take these 6 selected and…
-
5
votes1
answer493
viewsHow do I get an image of the computer inside a java application?
I have a registration and I would like the user to choose an image to represent it. Otherwise, a default image would appear. That is, in a certain part of the register would have a button that when…
-
5
votes2
answers839
viewsWhat does Java FE and BE mean?
I’m starting with the Java language and today I came across a text mentioning Java (FE and BE). What do these acronyms mean?
-
5
votes2
answers1800
viewsHow to return Activity call data to the one who called it?
I saw several examples of passing data between Activity of a Textview receiving data from a Edittext. Which is the best way to do the reverse, I explain: I have a reader that reads a barcode and…
-
5
votes1
answer5094
viewsSetting up Tomcat 7 in Eclipse results in HTTP Status 404
I downloaded the version tar-gz Tomcat 7 and linux manually set the variable CATALINA_HOME entered the command $CATALINA_HOME/bin/startup.sh and I stopped http://localhost:8080/, worked normally…
-
5
votes4
answers13756
viewsSort List in java
I have a List<Pessoa> where the attributes of the object are: Name, age, address, etc. I have a screen where I insert people in this list and I submit a report, I would like to display this…
-
5
votes2
answers1522
viewsHow to read data from txt files using Java?
Is there any mechanism to store the data of a file in a Linkedlist .txt? For example, how would this list have as elements the strings "Caio", "Pedro" and "Luiza"? import java.io.*; public class…
-
5
votes1
answer149
viewsChecking string inside string
How to know if a specific text is contained in a string? example: String str = " Hello Word"; How do I check if the word "Hello" is contained in that string "str". And if the check is true, how do…
-
5
votes1
answer2999
viewsCreate button via code
It is possible to create a Button through code, rather than design mode (xml)? For example: I will create a screen with a EditText, enter a number, and click on a Button. After that, it will be…
-
5
votes3
answers2023
viewsIs there a nomenclature standard for enums?
I don’t know much about object naming patterns. I’m creating a enum who lists positions, for example: manager, programmer, attendant... There is a pattern to name this Enum? EnumCargo, CargoEnum,...…
-
5
votes1
answer2476
viewsPhoto taken by camera returns reversed
Is there any way not to invert the photo after updating it in an Imageview? For example, the application I’m developing accesses the device’s camera and after taking the photo, updates Imageview…
-
5
votes2
answers1319
viewsError generating files/classes from a Netbeans Web Service
I am trying to generate files/class from a Web Service and bring it to my Java project. For this I am using Netbeans IDE 8.0.2 At first I’m getting the message "Uma classe/interface com o mesmo nome…
-
5
votes2
answers2138
viewsJava and Postgresql/ MYSQL encryption
Hello I’m having a question in my college project, in scope it says like this: "Users and passwords can be stored in the database, using the database’s own encryption." Is the crypt in both by…
-
5
votes0
answers833
viewsError deploying to Wildfly 8: Failed to define class
I am getting the error below when trying to deploy my application, after migrating from Jboss AS 7.1 to Wildfly 8.2 and Java 7 to Java 8 and still cannot identify the source of this error. I’m using…
-
5
votes2
answers349
viewsKnow if a class is native to JAVA or created by the User?
I created a method that uses Reflection to run getters on top of an object, but I need to know if the class is native to JAVA, for example: java.lang.String, or whether it has been implemented by…
-
5
votes2
answers90
viewsError with Java arrays
Could someone tell me what’s wrong with this code? The result is always the first number before the space, but has to be the sum of all numbers in the array. import java.util.Scanner; public class…
javaasked 9 years, 3 months ago pedrocarboni 117 -
5
votes1
answer408
viewsOperations on matrix with no defined size
I need to perform operations on a matrix that will be passed by parameter, the problem is that its size is not fixed so I do not know how to perform the loop to go through the end of a column or row…
-
5
votes2
answers813
viewsTreat Arithmeticexception in another method
I want to create a divide method (double a, double b) that has Try/catch to catch the Arithmetic Exception, returning an error message by System.out.println; as it is not in the main method, I do…
-
5
votes3
answers7105
viewsConvert String with date to Datetime in Java
I have a CSV file and in it has a column with String: "Sun Oct 05 20:59:57 BRT 2014" I need to pass the CSV data to a Mysql table. Therefore, I need to convert this string to Datetime format so I…
-
5
votes2
answers352
viewsDoubt with datatable and/or JSF/JPA modeling
Good evening, I have the following problem... at first it seems kind of silly, but honestly I can’t get out of it I want to create a table where the columns are Sunday, Monday, Tuesday, Wednesday,…
-
5
votes1
answer1390
viewsHow to read . txt file?
How do I read a file .txt which is written in lines and check if in a row that file has a value if you have made a check on checkbox. Example: txt files: 123 234 2456 If you have the file 123,…
-
5
votes2
answers114
viewsHow to get a Date String?
My question is how to get a string and manipulate it. The user will inform dd/mm/yyyy in the form of String. How do I make this catch? And then I need to make this date whole so that I can do the…
-
5
votes2
answers718
viewsWhat is the most threads supported by Java EE?
I’m analyzing how to rewrite the architecture of a Java program I’d like to know how many threads the scheduler (Scheduler) supports? or how can I infer this amount based on the processing power of…
-
5
votes1
answer2070
viewsJava Arraylist - Overriding values
Guys need to perform the following activity: "Consider an application to store the following data of a person in an address book: name, address, and phone. Specify a TAD to store the data of persons…
-
5
votes3
answers697
viewsNoclassdeffounderror
When I try to open the program it does not find the nativehook class, but it is in the classpath Error: C:\Users\Paulo\Desktop>java -jar AutoClick.jar Exception in thread "main"…
-
5
votes1
answer612
viewsIn Spring MVC, how to send information to the view (.jsp) without using Modelandview?
I am developing a web application in Spring MVC. I have a method that returns a list (java.util.List) and I need to pass it to the view (.jsp), but without updating the page. I would like to know…
-
5
votes2
answers18970
viewsHow does Hibernate.hbm2ddl.auto work?
What values can I use on this property? ex: Update <prop key="hibernate.hbm2ddl.auto">update</prop> How does it work? When should I use? is good practice?…
-
5
votes1
answer148
viewsHow do I start Maps in a specific place?
How do I make the App, when opening Google Maps, zoom in on a specific place (for example, a specific coordinate)? The codes of the demo it shows ALL continents when initializing being necessary to…
-
5
votes1
answer858
viewsHow to work with environment variables?
I am developing an application that works with files (save and upload) and have to work with system variables to determine where to save these files. My question is: Is there any way to use…
-
5
votes2
answers205
viewsFrom . NET to Java, what technologies or frameworks do you use?
I currently have a . NET-based work infrastructure with Angular JS and a possibility of a new project using Java has emerged. With . NET I use the following technologies: ASP.NET Identity Used for…
-
5
votes2
answers4825
viewsHow to apply the Singleton pattern correctly?
The class PEHandlerService need to have a single instance and do not want to use synchronized because of the slowness, I developed the following code: public class PEHandlerService extends…
-
5
votes3
answers2556
viewsHow to know how many objects were instantiated?
In a Java application, how do I know how many objects in a class were instantiated? This doubt came to me by reading the article mentioned in the link below. It follows the excerpt that led me to…
-
5
votes3
answers698
viewsIn OOP, what are the differences between Afferent Coupling and Efferent Coupling?
With regard to the concept of acoplamento in Programação Orientada a Objetos, what are the differences between Acoplamento Aferente and Acoplamento Eferente? If possible, to better elucidate the…
-
5
votes1
answer1084
viewsHow to get the coordinates of a point at a certain distance from my location?
Speak guys, I’m making an app, and in an app Activity need from my location to "zoom" in the maps as the user slides a seekBar, as per the image. I’ve been thinking about using the Bounds feature on…
-
5
votes2
answers168
viewsjava desktop "ajax" exists?
I wonder if there is any way to return the value to my java desktop application every time a value is added to a table. Something like ajax for browser. For example. We have the requested table and…
-
5
votes2
answers135
viewsWhile with incomprehensible format
My knowledge in java is very basic, before that I came across a question to which I have not found answer. The code snippet below is used in some of my applications: File arquivo = new…
-
5
votes1
answer544
viewsEncryption using java stacks
In an encrypted message using stack to invert each word of a String and using the chatAt(int) to pick up specific characters from it, I had the following problem, when placing a character on the…
-
5
votes1
answer228
viewsChanged database data is not shown in the Primefaces Datatable
I am trying to disable JPA cache (Eclipselink 2.5.2) through "persistence.xml", but it is not working. Changes made to the tables, externally to the application, are not presented in the Primefaces…
-
5
votes1
answer1926
viewsHow to declare and initialize two-dimensional matrices?
I have to save the row, column and contents of a spreadsheet. For this I created a two-dimensional matrix. My difficulty is how to initialize it? I believe the statement is no longer correct because…
-
5
votes1
answer248
viewsjava.lang.Illegalstateexception when declaring aspect with Spring
I’m trying to state this aspect: @Aspect @Component public class UpperCaseAdvice { @Before("@target(annotations.Model)") public void toUpperCase(JoinPoint joinPoint){ //faz alguma coisa } } I am…
-
5
votes1
answer347
viewsWhat is CDI technology?
I am developing a web application and a university colleague who is a few periods beyond what I am currently studying said that using CDI would have a better performance, however, until now had not…
-
5
votes1
answer769
viewstxt file is not found when generating file. jar
I have an application in Java, this application has images, and I had the same problem: when generating the arch. jar(executable) the images did not appear, but if it ran straight into Netbeans, it…
-
5
votes1
answer343
viewsHow to get a resource that is in the same class package that will use it?
I created a Java project with the following structure: src |-br.foo.settings | |- settings.json | |- Settings.java | |- ... outros pacotes ... As I am used to the JSON file format, I thought of…
javaasked 9 years, 7 months ago Renan Gomes 19,011 -
5
votes2
answers993
viewsOperation of variables by reference
I know that variables by reference in java serve to provide a location in memory of a certain object. However, how does this mechanism work? It is equal to the C language, where the reference types…
-
5
votes2
answers1016
viewsHow to create Production Application Error Report (Client)
I am looking for a way (efficient and practical) to capture globally all Exceptions not dealt with by the application (the ones that lead the application to crash or "Application stopped working!").…