Java - Programming Language
This course covers the basics of programming in Java. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!

Static Class Attributes

Lesson 32
Author : 🦒
Last Updated : October, 2017


Code

Copyclass Song{
     public String title;
     public String artist;
     public static int songCount = 0;

     public Song(String title, String artist){
          this.title = title;
          this.artist = artist;
          songCount++;
     }
}

public class App{
     public static void main(String [] args){
          Song mySong = new Song("Holiday", "Green Day");
          System.out.println(Song.songCount);
     }
}