java

Where to store constants in Java/Android?

Hello. I want to write the right code, so I wondered. After all, where is it better to store constants in Java? Now I pick t ... hy this was done? How they work protected/private interface and where is it better to store constants? Thank you in advance.

What is the best way to read data from the console?

I solve Olympiad problems of this kind in java. I wrote the algorithm for solving the problem. There was a problem with how t ... il it counts 10,000 characters, the program will not continue working. How do you recommend solving this problem? a problem?

Jar does not see files that are in the same directory with it

There is a simple program in which I read information from a file, using FileInputStream. The file is located in the root dir ... e the following construction: FileInputStream fin = new FileInputStream("input.txt"); Thank you in advance for your reply)

Injecting fields without the c Dagger 2 constructor

On the site with documentation for Dagger 2, there is the following example code and words: class CoffeeMaker { @Inject He ... In case the Heater object has not been created before? And if this is its object is it currently being used by another class?

how to use the instanceof method correctly

The task is given: Create a static printMagazines(Printable[] printable) method in the Magazine class that outputs only the n ... java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3 at Main.main(Main.java:19) Thank you in advance!

How to translate code from Java to Kotlin?

Please tell me, was there such a code in the Java project before private static Queries q; private static SQLiteDatabase db; ... tion(), and can I call it as before in Java classes with this method? q = App.getQueriesInstance(getApplicationContext());

The emulator does not start in Android Studio | emulator process for ... was killed

The emulator does not start through Android studio, neither through AVD Manager, nor through the launch of the application H ... talling Windows and installing Android Studio on a new Windows, this is what happened. I will be very grateful for your help!

"Could not find or load main class" when running the program

I am trying to perform the usual Hello, World, as it is said in one of the manuals. class HelloWorld { public static ... \bin>java HelloWorld Error: Could not find or load main class HelloWorld C:\Program Files\Java\jdk1.7.0_07\bin>

Java. Using the jar.

You need to use a function that is located in a certain jar. There are no source codes. But at the same time, I do not want to increase my program by a couple of MB for the sake of one function. Is it possible to solve this problem somehow?

How to create a BAT file to run Autotests

I wrote Auto tests in Java using the Selenid library right now I want to create a Bat file to run these tests not through the Intellij program but through this file

Deep copying of an array of java objects

How can I use the mass of objects (native, non-native)?String, Integer and so on) copy it to another array along with copies ... num + " " + massiv2[1].num + " " + massiv2[2].num); } } class Mas { int num; } Conclusion: 1 2 3 1 2 3 4 2 3 4 2 3

How do I open a file or folder from a java application?

How can we open a file or folder, as if we are opening it through a standard file browser / Finder / etc.

Android Studio and Java

Hi) I know Python well, and as soon as I realized that I wanted to try to make my own application, I decided to study this to ... it, in others they just download it and that's it, without any Java. Are there any people familiar with this? Please help me.

Connecting OpenCV to a Java project

When executing code from the tutorial: static{ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); } public static void main ... quite clear what to do. Download the system library named *411, or install an older version of OpenCV that has version 410?

Problem to connect to MySQL with Java

I write in IntelliJ IDEA I copied everything from the site with explanations, but nothing works. I am trying to connect to th ... in.java:22) Process finished with exit code 1 I imported the JBDC driver via File>Project Structure в IntelliJ IDEA

Java server for Android applications

I need to make a server in java that will work with the database and perform other functions. The choice fell on the server b ... to fix it. It is possible to completely change architecture or toolkit. The main thing is that the server is written in Java.

I can't understand why there is an error in the code, the topic is InputStream and OutputStream

Have a nice day! Please tell me what is the error in this code. An error occurs: the output stream was empty when it was no ... { if ((result = (byte) i) % 2 == 0) { outputStream.write(result); } } } }

Output of odd array elements separated by commas Java

Please help me understand : there is a method called printOddNumbers that accepts an array and outputs only odd numbers from ... } System.out.println(stringBuilder); stringBuilder.append(System.getProperty("line.separator")); } Output: 3,5,7,3,

Java-class name

Please tell me how to compare the class name with the specified string( the string is entered by the user). Is there any way to write the class name to a string variable?