Nochmal Danke an alle. Ich hab die Lösung gefunden.

public static void UpdateBestellungen(int id, int anzahl) {
		String sql = "UPDATE Bestellung SET Anzahl=? Where id=" + id;
	
		try {
			System.out.println(anzahl + " "+ id);
			Connection conn = connect();
			
			PreparedStatement ps = conn.prepareStatement(sql);
			ps.setInt(1, anzahl+1);

			ps.execute();
			
			conn.close();


		} catch (Exception e) {
		
			System.out.println(e.getMessage());
		}
		
	}
...zur Antwort

Ich hab mir die Aufgabe heute morgen nochmal angeschaut. Und in der Aufgabe selbst steht nichts davon ob die Menge A oder B Reelle Zahlen oder Natürlichezahlen sind.

Die Aufgabe heißt einfach nur Berechne A U B, A N B A/B und B/A.

...zur Antwort
Java Programm geschriben und kp wo die Klassen hin müssen!

Hallo

Ich habe ein Java Programm geschrieben mit verschiedenen Klassen.Mein Problem ist jetzt das ich nicht weiss wo ich den Programm sage wo die Klasse zu finden ist.Kann mir jemand sagen wo des in den Unten stehenden code rein muss? Das hier ist die Hauptklasse

import java.awt.event.ActionEvent; import java.awt.event.ActionListener;

import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel;

@SuppressWarnings("serial") public class frame1 extends JFrame implements ActionListener {

private JButton ende;

private JButton e

public static void main (String[]args) throws Exception{ 
        
    
frame1 frame = new frame1("Startseite A");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400,400);

frame.setLayout(null);
frame.setVisible(true);



}

public frame1(String title) {
    
    super(title);



     ende = new JButton("Beenden");
        ende.setBounds(120, 280, 160, 40);
        ende.addActionListener(this);
        add(ende);
       
    
    
      e = new JButton("Hallo");
        e.setBounds(120, 280, 160, 40);
        e.addActionListener(this);
        add(e);
       
        
        
        JLabel label = new JLabel("Made by  (Version 0.1)");
        label.setBounds(240,340,150,20);
        add(label);
        
        
};
        
    
    
    
        public void actionPerformed1(ActionEvent e){
            
            
                if (e.getSource() == ende){
                System.exit(0);
                
        }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
};
@Override
public void actionPerformed(ActionEvent arg0) {
    // TODO Auto-generated method stub
    
}

}

Das hier ist die Klasse wo das Programm wissen soll das es die gibt;

import java.awt.event.ActionEvent; import java.awt.event.ActionListener;

import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel;

@SuppressWarnings("serial") public class Hallo extends JFrame implements ActionListener {

private JButton ende1

public static void main (String[]args) throws Exception{ 
        
    
frame1 frame = new frame1("Startseite B");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400,400);

frame.setLayout(null);
frame.setVisible(true);

}

public frame1(String title) {

    super(title);



        ende1 = new JButton("Beenden");
        ende1.setBounds(120, 280, 160, 40);
        ende1.addActionListener(this);
        add(ende1);











        public void actionPerformed1(ActionEvent e){
            
            
                if (e.getSource() == ende1){
                System.out.println(Hallo Klasse Hallo);
                
        }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
};
@Override
public void actionPerformed(ActionEvent arg0) {
    // TODO Auto-generated method stub
    
}

...zum Beitrag

Danke Schon mal im Vorraus!

Mcchecker1000

...zur Antwort