Hi i made a Starship game and i wanted to make 2 Missiles instead of one so i made a new Class called it SuperMissile and copied all the text from the original Missile class and then i went to my Player/spaceship class and made a new Keyboard handling so when you pressed 'O' it should create a new SuperMissile? I will give you the codes from the 3 Classes:

EDIT: It works when i don't use the O key and just use the normal Missile
EDIT 2: I have some other classes with the frame, board and more...

This is the SpaceShip class.

import java.awt.Image;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.io.File;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;

import javax.swing.ImageIcon;

public class Craft {

private String craft = "craft.png";

private int dx;
private int dy;
private int x;
private int y;
private int width;
private int height;
private boolean visible;
private Image image;
private ArrayList missiles;
private Collision col;
private Board b;
private Boss boss;
int HP = 5
;


public Craft() {
ImageIcon ii = new ImageIcon(this.getClass().getResource(craft));
image = ii.getImage();
width = image.getWidth(null);
height = image.getHeight(null);
missiles = new ArrayList();
visible = true;
x = 40;
y = 60;
}


public void move() {

x += dx;
y += dy;

if (x < 1) {
x = 1;
}

if (y < 1) {
y = 1;
}
}

public int getX() {
return x;
}

public int getY() {
return y;
}

public Image getImage() {
return image;
}

public ArrayList getMissiles() {
return missiles;
}

public void setVisible(boolean visible) {
this.visible = visible;
}

public boolean isVisible() {
return visible;
}

public int HP (int HP){
return HP;
}

public Rectangle getBounds() {
return new Rectangle(x, y, width, height);
}

public void keyPressed(KeyEvent e) {

int key = e.getKeyCode();

if (key == KeyEvent.VK_SPACE) {
fire();
}

if (key == KeyEvent.VK_O) {
superFire();
}

if (key == KeyEvent.VK_LEFT) {
dx = -1;
}

if (key == KeyEvent.VK_RIGHT) {
dx = 1;
}

if (key == KeyEvent.VK_UP) {
dy = -1;
}

if (key == KeyEvent.VK_DOWN) {
dy = 1;
}

if (key == KeyEvent.VK_R){
System.exit(0);
}
}

public void fire() {
missiles.add(new Missile(x + width, y + height/2));
}

public void superFire() {
missiles.add(new SuperMissile(x + width, y + height/2));
}

public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();

if (key == KeyEvent.VK_LEFT) {
dx = 0;
}

if (key == KeyEvent.VK_RIGHT) {
dx = 0;
}

if (key == KeyEvent.VK_UP) {
dy = 0;
}

if (key == KeyEvent.VK_DOWN) {
dy = 0;
}
}
}



This is the Normal Missile Class:

import java.awt.Image;

import java.awt.Rectangle;

import javax.swing.ImageIcon;

public class Missile {

private int x, y;
private Image image;
boolean visible;
private int width, height;

private final int BOARD_WIDTH = 800;
private final int MISSILE_SPEED = 2;

public Missile(int x, int y) {

ImageIcon ii =
new ImageIcon(this.getClass().getResource("missile.png "));
image = ii.getImage();
visible = true;
width = image.getWidth(null);
height = image.getHeight(null);
this.x = x;
this.y = y;
}


public Image getImage() {
return image;
}

public int getX() {
return x;
}

public int getY() {
return y;
}

public boolean isVisible() {
return visible;
}

public void setVisible(Boolean visible) {
this.visible = visible;
}

public Rectangle getBounds() {
return new Rectangle(x, y, width, height);
}

public void move() {
x += MISSILE_SPEED;
if (x > BOARD_WIDTH)
visible = false;
}
}

This is the MissileSuper Class:

import java.awt.Image;

import java.awt.Rectangle;

import javax.swing.ImageIcon;

public class SuperMissile {

private int x, y;
private Image image;
boolean visible;
private int width, height;

private final int BOARD_WIDTH = 800;
private final int MISSILE_SPEED = 2;

public SuperMissile(int x, int y) {

ImageIcon ii =
new ImageIcon(this.getClass().getResource("missile.png "));
image = ii.getImage();
visible = true;
width = image.getWidth(null);
height = image.getHeight(null);
this.x = x;
this.y = y;
}


public Image getImage() {
return image;
}

public int getX() {
return x;
}

public int getY() {
return y;
}

public boolean isVisible() {
return visible;
}

public void setVisible(Boolean visible) {
this.visible = visible;
}

public Rectangle getBounds() {
return new Rectangle(x, y, width+20, height+20);
}

public void move() {
x += MISSILE_SPEED;
if (x > BOARD_WIDTH)
visible = false;
}
}


Thanks :D