Click here to Skip to main content
15,895,256 members
Home / Discussions / Java
   

Java

 
GeneralRe: Please help with java assignment Pin
Nagy Vilmos6-Oct-11 23:31
professionalNagy Vilmos6-Oct-11 23:31 
GeneralRe: Please help with java assignment Pin
mastdesi6-Oct-11 6:33
mastdesi6-Oct-11 6:33 
GeneralRe: Please help with java assignment Pin
Nagy Vilmos6-Oct-11 23:58
professionalNagy Vilmos6-Oct-11 23:58 
AnswerRe: Please help with java assignment Pin
I.explore.code12-Oct-11 4:31
I.explore.code12-Oct-11 4:31 
QuestionMultilevelqueue Pin
jhencer1111085-Oct-11 12:40
jhencer1111085-Oct-11 12:40 
AnswerRe: Multilevelqueue Pin
Richard MacCutchan5-Oct-11 21:49
mveRichard MacCutchan5-Oct-11 21:49 
AnswerRe: Multilevelqueue Pin
Nagy Vilmos5-Oct-11 22:35
professionalNagy Vilmos5-Oct-11 22:35 
QuestionTroubble with "new" Pin
Tor Danielsen4-Oct-11 11:00
Tor Danielsen4-Oct-11 11:00 
Just got home from my wedding trip and only 4 days left at one java exercise before it gotta be delivered in.

I've made one class "Bil1" but when i'm doing the client program

Bil1 minBil = new Bil1() the compiler gives me one error.

C:\Java\Øving 5>javac bil.java
bil.java:43: cannot find symbol
symbol  : constructor Bil1()
location: class Bil1
    Bil1 minBil = new Bil1();
                  ^
1 error


Got no idea where I've done wrong here.

here is the complete code also.

Java
class Bil1{
	public final String regNr;
	public final String merke;
	public final int årsmodell;
	public final int hastighet;
	public final boolean motorenIGang;

	public Bil1(String regNr, String merke, int årsmodell, int hastighet, boolean motorenIGang){
		this.regNr = regNr;
		this.merke = merke;
		this.årsmodell = årsmodell;
		this.hastighet = hastighet;
		this.motorenIGang = motorenIGang;
	}

	public String getRegNr() {
		return "VD-12345";
	}

	public String getMerke() {
		return "Volvo";
	}

	public int getÅrsmodell() {
		return 2002;
	}

	public int getHastighet() {
		return 55;
	}

	public boolean getMotorenIGang() {
		return true;
	}
}


class Bil1Test {
  public static void main(String[] args) {

    /* 1. programsetning: Lager et Bil1-objekt (med referanse) minBil
     vha. standardkonstruktøren: */
    Bil1 minBil = new Bil1();

    /* 2. programsetning: Skriver ut innholdet i minBils objektvariabler: */
    System.out.println("Regnr " + minBil.regNr
        + ", merke " + minBil.merke
        + ", årsmodell " + minBil.årsmodell
        + ", hastighet " + minBil.hastighet
        + ", motorenIGang " + minBil.motorenIGang);
  }
}

AnswerRe: Troubble with "new" Pin
DaveAuld4-Oct-11 12:03
professionalDaveAuld4-Oct-11 12:03 
GeneralRe: Troubble with "new" Pin
Tor Danielsen4-Oct-11 12:28
Tor Danielsen4-Oct-11 12:28 
GeneralRe: Troubble with "new" Pin
DaveAuld4-Oct-11 13:37
professionalDaveAuld4-Oct-11 13:37 
AnswerRe: Troubble with "new" Pin
Luc Pattyn4-Oct-11 13:40
sitebuilderLuc Pattyn4-Oct-11 13:40 
AnswerRe: Troubble with "new" Pin
Nagy Vilmos4-Oct-11 21:47
professionalNagy Vilmos4-Oct-11 21:47 
AnswerRe: Troubble with "new" Pin
Richard MacCutchan4-Oct-11 21:50
mveRichard MacCutchan4-Oct-11 21:50 
AnswerRe: Troubble with "new" Pin
TorstenH.4-Oct-11 23:57
TorstenH.4-Oct-11 23:57 
GeneralRe: Troubble with "new" Pin
Nagy Vilmos5-Oct-11 0:12
professionalNagy Vilmos5-Oct-11 0:12 
GeneralRe: Troubble with "new" Pin
Richard MacCutchan5-Oct-11 0:20
mveRichard MacCutchan5-Oct-11 0:20 
GeneralRe: Troubble with "new" Pin
TorstenH.5-Oct-11 4:08
TorstenH.5-Oct-11 4:08 
GeneralRe: Troubble with "new" Pin
Richard MacCutchan5-Oct-11 4:37
mveRichard MacCutchan5-Oct-11 4:37 
GeneralRe: Troubble with "new" Pin
David Skelly5-Oct-11 3:41
David Skelly5-Oct-11 3:41 
GeneralRe: Troubble with "new" Pin
TorstenH.5-Oct-11 4:06
TorstenH.5-Oct-11 4:06 
GeneralRe: Troubble with "new" Pin
David Skelly5-Oct-11 22:17
David Skelly5-Oct-11 22:17 
GeneralRe: Troubble with "new" Pin
Nagy Vilmos5-Oct-11 22:29
professionalNagy Vilmos5-Oct-11 22:29 
AnswerRe: Troubble with "new" Pin
chalspaul6-Oct-11 4:41
chalspaul6-Oct-11 4:41 
QuestionJava Based Search Service in Oracle CC&B Pin
BalajiGuna3-Oct-11 21:56
BalajiGuna3-Oct-11 21:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.