Okay I'm a beginner programmer and I just can't seem to get the most basic class and constructor to work.

Heres what I have

import java.io.*;

public class bankAccount
{
//instance variables
String name;
int number;
double balance;
}

public bankAccount(String name, int number, double balance)
{
	name = "John Smith;
	number = 123456;
	balance = 0.0;
}

I get the error "class, interface, or enum expected" whenver I compile. I'm missing something completely basic here I know it...

Good Lord almighty. I spent the past 30 minutes trying to figure it out.... My curly braces aren't in the right position.

FML

Well, that, and the missing quote where you set name, and the fact that you are simply resetting local values in that constructor rather than setting the instance values, but I'll assume you know all that by now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.