Moving elements in an array, Java

Values ​​that have the same peer index (for example (0) (0)) must be moved to the next peer index
(for example (2) (2)). The last element of the peer index should pass to the index (0) (0)
The same should be repeated for items in odd positions. (for example (1) (1), (3) (3),
(5) (5) and so on)

19.04 – Why intelliJ is trying to use java 12 if I set SDK version 11.0.4?

I'm trying to run a little java code created by someone else with intelliJ
(I am a beginner); but for some reason, even though I selected java 11.0.4 (3) in the project settings, I generated it after it was built:

Error:java: error: release version 12 not supported

I've therefore decided to install java 12 by following this guide:

How to Install Oracle Java 12 in Ubuntu 18.04 / 16.04


and the terminal also says that I now have java 12.02 by default.

I've added java 12 to the IntelliJ software development kits but now, if I go from version 11 to the version of the project, another error occurs, this time at runtime:

java.lang.UnsupportedClassVersionError: (class path) has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 55.0

so I do not understand, what does it want to know, to be able to do it?

About the use of the interface in Java [duplicada]

This question already has an answer here:

  • Programming is centered on the interface rather than on implementation, why?

    1 answer

  • In object orientation, why are interfaces useful?

    7 Answers

  • How and when to use Interface?

    2 answers

Why in Java should the use of interfaces be prioritized over class inheritance?

java – Modify a String resource in string.xml from code

I am developing a quiz app in which I have a section where I can edit the questions asked. The problem is that the questions are stored in the strings.xml file. I know how to show what they have, but I have to record. the modified text in the same reference, example:
I have this reference in strings.xml

    Al pensar en su experiencia más reciente con NOMBRE EMPRESA, ¿cómo fue la calidad de servicio al cliente que recibió?

The idea is that in the same application you can change this string to change the name of the company, and when you see the quiz again, see the change.

Help me, gods of programming

catch a duplication error in mysql with java

I'm trying to show a message that there is already a registered identifier, but it falls into the catch that shows:

 com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'idusuario' 

I want to show that there is already a registered identifier.

 try {
        conexao=ConexaoBanco.conector();
        pst=conexao.prepareStatement(sql);
        pst.setString(1,nomeusuario);
        pst.setString(2,senha);  
        try{            
            pst.setInt(3,Integer.parseInt(idusuario));
        }catch(SQLException x){
            JOptionPane.showMessageDialog(null,"ID JÁ CADASTRADA");
        }
        pst.setString(4,perfil);     
        pst.setString(5,nome);          
        pst.executeUpdate();
        return true;
    } catch (SQLException e) {
        JOptionPane.showMessageDialog(null,e);
        return false;   
    }

java – Download the file in Classpath Spring

Hi I have a question what is the root path of a project "Java" with "framework Spring" download files from jsp, I want to upload any file from one at "Classpath" then read them on other pages, but I have no idea which codes to use in Java Spring. Also by searching online, I see that they say you can download files in many ways, but I'd like to know one.
S? They had a example It would be useful to understand.
"As always, any help is welcome."

java – Replace each letter with the letter in the corresponding position at the end of the English alphabet

I wrote a little program for the hyperskill / jetbrains academy in order to encrypt the message "we found a treasure!" and print only the cyphertext (lowercase) by replacing each letter with the letter in the corresponding position at the end of the English alphabet (a → z, b → y, c → x, … x → c, y → b, z → a) and without replacing the spaces or the exclamation point.

I would like the code review comments in terms of correct use of Java.

package encryptdecrypt;

public class Main {

    final static int lower_case_a = 'a';
    final static int lower_case_z = 'z';

    public static void main(String() args) {
        String s = "we found a treasure!";

        StringBuffer reverse = new StringBuffer();

        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);

            if ((int)c >= lower_case_a && (int)c <= lower_case_z)
                reverse.append((char)(lower_case_z - c + lower_case_a));
            else
                reverse.append((char) c);
        }
        System.out.println(reverse.toString());
    }
 }

Java – Application run JavaFX

You are the manager of JavaFX policy management when performing access control and configuration of your consoleless computer:

Exception in the startup method of the application
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0 (native method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at the address com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs (LauncherImpl.java:389)
at the address com.sun.javafx.application.LauncherImpl.launchApplication (LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (native method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at sun.launcher.LauncherHelper $ FXHelper.main (LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: exception in the application startup method
at the address com.sun.javafx.application.LauncherImpl.launchApplication1 (LauncherImpl.java:917)
at the address com.sun.javafx.application.LauncherImpl.lambda $ launchApplication $ 1 (LauncherImpl.java:182)
on java.lang.Thread.run (Thread.java:748)
Caused by: javafx.fxml.LoadException: Error while solving onAction = "ClickBotao", the event handler is not in the namespace or there is a error in the script.
file: / C: /Users/eder/Documents/NetBeansProjects/OlaMundojavafx/dist/run1545924897/OlaMundojavafx.jar! /olamundojavafx/FXMLDocument.fxml: 11

at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2597)
at javafx.fxml.FXMLLoader.access$100(FXMLLoader.java:103)
at javafx.fxml.FXMLLoader$Element.processEventHandlerAttributes(FXMLLoader.java:610)
at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:770)
at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2823)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2532)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at olamundojavafx.OlaMundojavafx.start(OlaMundojavafx.java:22)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177)
... 1 more

Exception of application in progress olamundojavafx.OlaMundojavafx
Java result: 1
Removing the C: Users eder Documents NetBeansProjects OlaMundojavafx Dist Run1545924897 Directory
jfxsa-run-no-another-jvm:
BUILD SUCCESSFUL (total time: 27 seconds)

java – Why does the app close when I want to show admob ads?

Hello everyone, I try to place admob ads in my app, but when I wish to run it, I close the application with a message informing me that it has stopped working.

I leave the codes to help me indicate my mistake.
thank you very much ..

manifesto


    

        
        
            

            
        
    

in the build.gradle I declare the dependency

dependencies {
implementation fileTree(dir: 'libs', include: ('*.jar'))
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.gms:play-services-ads:18.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

ManActivity

private PublisherAdView mAdView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    AdView adView = new AdView(this);
    adView.setAdSize(AdSize.BANNER);adView.setAdUnitId("ca-app-pub-3940256099942544/6300978111");

    MobileAds.initialize(this, new OnInitializationCompleteListener() {
        @Override
        public void onInitializationComplete(InitializationStatus initializationStatus) {
        }
    });
}
}

activity_layaout



Cheap Java Hosting USA | Java Hosting Provider – Global Host IT Smart – Advertising, Offers

HostITsmart is the best provider of web hosting services that provides you with all types of web hosting solutions. We assure you that your website is fast, secure and always operational so you can focus on your work. We offer everything you need to create, host and manage your website with 24 * 7 technical support. There are no hidden fees and a 30 day money back guarantee. Choose the best web hosting service in the world for your website.

Server locations:

India

WE

Below is the list of our quality plans-

Linux hosting plan
Start Plan – @ $ 1.50 / per month – Buy Now

Unlimited Web space

Unlimited bandwidth

1 website

Unlimited email IDs

1 subdomain

2 MYSQL space

Performance Plan – @ $ 2.50 / per month – Buy Now

Unlimited web space

Unlimited bandwidth

5 sites

Unlimited email IDs

Unlimited number of subdomains

10 MYSQL space

Business Plan – @ $ 5 / per month – Buy Now

Unlimited Web space

Unlimited bandwidth

Unlimited sites

Unlimited email IDs

Unlimited number of subdomains

Unlimited data space

For more details on Linux hosting plans, visit the site
https://global.hostitsmart.com/hosting/linux-hosting

Windows Hosting
Plan of departure – @ 2 $ / per month – Buy now

250 MB of web space

Bandwidth of 50 GB

1 website

25 email identifiers

1 MSSQL / MYSQL space

Performance Plan – @ $ 4 / per month – Buy Now

Unlimited web space

Unlimited bandwidth

5 websites

Unlimited subdomains

10 MSSQL / MYSQL space

Unlimited email identifiers

Business Plan – @ $ 6 / per month – Buy Now

Unlimited web space

Unlimited bandwidth

Unlimited sites

Unlimited subdomains

Unlimited email identifiers

20 MSSQL / MYSQL space

For more details on Windows hosting plans, visit the site
https://global.hostitsmart.com/hosting/windows-hosting

WordPress Hosting
Start Plan – @ $ 1.50 / per month – Buy Now

Unlimited web space

Unlimited bandwidth

1 website

Unlimited email identifiers

1 subdomain

2 MYSQL space

1 area of ​​the park

1 FTP accounts

Performance Plan – @ $ 2.50 / per month – Buy Now

Unlimited Web space

Unlimited bandwidth

10 websites

Unlimited email identifiers

10 subdomains

10 MYSQL space

5 parks

10 FTP accounts

Business plan- @ $ 5 / per month – Buy Now

Unlimited Web space

Unlimited bandwidth

Unlimited sites

Unlimited number of subdomains

Unlimited data space

Unlimited park area

Unlimited FTP accounts

For more details on WordPress hosting plans, visit
https://global.hostitsmart.com/hosting/wordpress-hosting

Our support team is always ready to help you in all situations and at any time, which will help you solve any problem in the fastest way possible. We also provide an instant chat service to easily connect you at any time.

For immediate assistance or for more information, contact us: info@hostitsmart.com or visit our website to chat live.

.