Questions tagged as 'java'

1
answer

How to save the Strings of a file read? [duplicate]

Personally I'm reading from a .txt file and would like to save all the strings how could I save it all? Below is my writing code that I'm using, in case I'd like to save the String line. public static void main(String[] args) throws IOExcept...
asked by 22.11.2017 / 02:39
1
answer

non static method write can not be referenced from a static context

I'm a beginner in android and in general programming, I was following a video lesson to write a string to a txt file, when I came across the following error:    Error: (49, 31) error: non-static method write (String) can not be   referenced...
asked by 18.11.2017 / 13:57
1
answer

Doubt regarding sizing methods in a Frame

What is the difference between the setSize() method and the setPrefferedSize() method in a Frame, and in which situation should each be used?     
asked by 12.03.2018 / 16:50
2
answers

Boot Block

I'm studying for certification. The book says that the declaration order of attributes and initialization blocks should be considered. Scenario # 1: while doing this: public class Teste { { System.out.println("Bloco: "...
asked by 14.08.2017 / 21:09
1
answer

How to keep text from a TextView after the App close

Well, I'm new to Android, but I'd like to know how I can keep / store the information in a TextView, so it will not be deleted when I close the application. public class Activity extends AppCompatActivity { Calendar c = Calendar.ge...
asked by 11.08.2017 / 19:00
1
answer

Close window when clicking JButton

Is it possible to click on a button and JFrame to be closed as if I had clicked on the X of the window? If it is possible, how do I create it? What I've already studied is using ActionListener but I can not find the code to clos...
asked by 14.11.2017 / 01:37
1
answer

Random numbers repeating

Well guys, it's this: I have a method that generates random numbers, and in the activity I try not to repeat those numbers, but it happens that they repeat themselves. What am I doing wrong? Method: private int numeroAleatorio() { int n...
asked by 13.11.2017 / 17:00
2
answers

Invert Simple List

   EXERCISE: Type a method that invokes a linked list:    Entry: 10, 99, 101, 666 Expected result: 666, 101, 99, 10 I thought I would follow the following logic: - I would get to the last element (666) with pe in the penultimate with q...
asked by 03.07.2017 / 21:33
1
answer

How to pass a local variable to an anonymous class?

I need to pass the control variable from a for , as a parameter to a method. The problem, is that I'm trying to do this according to the JRadioButton that was selected, I'm creating them according to my for, and defined events for t...
asked by 08.07.2017 / 22:41
1
answer

Can I create a complete application without using the swing? [closed]

I'm creating a system and a question has arisen! Could you create forms without using Swing, AWT or the basic libraries in Java? If I use another framework, can I leave out the Swing, AWT etc? What better framework to work with today?    ...
asked by 08.07.2017 / 16:38