Questions tagged as 'java'

1
answer

Scanner.nextLine () does not act correctly after Scanner.nextInt ()

I have this code: Scanner scan = new Scanner(System.in); String s2 = scan.nextLine(); int i2 = scan.nextInt(); System.out.println("natural= " + i2); System.out.println("cadena = " + s2); scan.close(); That works correctly:    This...
asked by 02.09.2016 / 11:45
3
answers

Is it advisable to include classes as nested classes, or is it better to keep them separated one per file?

When creating the classes in a project you have the option to have nested classes. Based on your development experience you should create nested classes in some particular cases or it is preferable to always maintain classes independently....
asked by 22.02.2017 / 15:12
5
answers

How to limit the number of decimals of a double?

As the title says, I want to limit the number of decimals that results from an operation with double type variables, this result is shown in a JTextArea of a JFrame. The code that does the operation and prints the result in the JTextArea is t...
asked by 23.10.2016 / 18:20
8
answers

Builders in java

Hello friends, sorry, I am studying java and in the classes the teacher touched on the topic of "java builders" and I did not really understand it. Well what I understood is this:    A constructor is similar to a method but only serves to...
asked by 06.10.2016 / 03:31
2
answers

Get public methods of a Java class

I need to get the list of public methods of a Java class, but I do not want to get the wait , toString , hasCode , etc, that the Java class inherits. I just want to get the public methods of that class, not those inherited from...
asked by 21.02.2018 / 13:28
3
answers

Does Java support the passing of variables by reference? [duplicate]

When I pass an object to a method using a parameter, the object is passed by value or reference? The doubt comes by this code: int a = 2; cambiar(a); System.out.println(a); public static void cambiar(int c) { c = 10; } In the previou...
asked by 16.02.2016 / 02:54
1
answer

Problem when testing a SOAP web service

I am implementing a SOAP web service in Java in an application that uses Struts in the presentation layer and I have trouble testing it. The IDE that I am using is Netbeans and the service was done using the assistant provided by the IDE. The ap...
asked by 04.12.2015 / 23:44
1
answer

Exercise clock in Java

I'm a newbie in this java and I just started classes, they sent us this exercise: Exercise 3 Design a class called Reloj with the integer attributes: hora (24 hours), minuto and segundo , and the following meth...
asked by 27.11.2018 / 12:32
2
answers

Problems with AVD in Android Studio

I need a little help, the android studio emulator is presenting me with a particular error, when launching a avd nexus_5 with API 21 , this appears: and then the emulator starts but on the black screen ... what could it be?...
asked by 17.12.2015 / 20:57
3
answers

Abstract class with constructor

Can a clase abstracta of Java have constructor ? And if so, what are your goals?     
asked by 02.12.2015 / 13:55