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!
I'm starting a coding bootcamp
Want to learn web development in a fun and gamefied environment? Head over to and see what I'm working on!

Getters And Setters

Lesson 31
Author : Mike Dane
Last Updated : October, 2017


Copypublic class Movie{
     public String title;
     private String rating;
     public int duration;

     public Movie(String title, String rating, int duration){
          this.title = title;
          this.duration = duration;

     public String getRating(){
          return this.rating;

     public void setRating(String rating){
          if(rating.equals("G") || rating.equals("PG") || rating.equals("PG-13") || rating.equals("R") || rating.equals("NR")){
               this.rating = rating;
          } else {
               this.rating = "NR";