Reputation: 91
What is the difference between final, const and static variables in java with code example please `
Upvotes: 3
Views: 5523
Reputation: 2327
class X
{
static int s; // can be accessed as X.s without object
final int f = 7; // can't be assigned a different value
const int c; // doesn't compile
}
Upvotes: 12