Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  

movie class..(dr java)



Share on Google+Share on Google+

movie class..(dr java)
1 Answer(s)      7 years ago
Posted in : Java Beginners
View Answers

November 27, 2009 at 3:41 PM

Hi Friend,

Try the following code:

import java.util.*;

public class movie{

private String movie_Title;
private String movie_Director;
private boolean watched_movie;
private String comment;
private int rating;

public movie(String movieTitle, String movieDirector,boolean watchMovie){

this.movie_Title = movieTitle;
this.movie_Director = movieDirector;
this.watched_movie = watchMovie;
this.comment = "";
this.rating = 0;

public String getMovie_Title(){
return movie_Title;
public String getMovie_Director(){
return movie_Director;
public boolean getWatched_movie(){
return watched_movie;

public static void main(String[]args) throws Exception{
ArrayList<movie> list=new ArrayList<movie>();
list.add(new movie("Kal Ho Na Ho","Karan Johar",true));
list.add(new movie("Jab We Met","Imtiaz Ali",true));
list.add(new movie("Taare Zamin Par","Aamir Khan",true));
list.add(new movie("DDLJ","Aditya Chopra",true));
list.add(new movie("Bhoot","Ram Gopal Verma",false));
File file = new File("C:\\movie.txt");
FileWriter fstream = new FileWriter(file,true);
BufferedWriter out = new BufferedWriter(fstream);

for (movie s : list){
System.out.println("Movie: "+s.getMovie_Title());
System.out.println("Directed by: "+s.getMovie_Director());
System.out.println("Your Comments: ");
Scanner input=new Scanner(;
String com=input.nextLine();
System.out.println("Your Ratings: ");
int rate=input.nextInt();
String st=Integer.toString(rate);
out.write(s.getMovie_Title()+" "+s.getMovie_Director()+" "+com+" "+st);




Related Tutorials/Questions & Answers:
movie class..(dr java) - Java Beginners
movie class..(dr java)  hi about to create a movie class... java.util.ArrayList; public class movie { private String movie_Title; private... the following code: import*; import java.util.*; public class movie
Movie and Cinema class - Java Beginners
Movie and Cinema class  Hi, I'm new in java. Can someone help me...: Question: 1. Create a new Movie class which has two properties, title... need your help please. //Movie class public class Movie { String
Need to push the combo box to flash movie - Java Beginners
Need to push the combo box to flash movie   Hi, I need to push the combo box values to the flash movie. I am succusfull in pushing the textfield using some pushand getMovie methods in java scripts and HTML[here we enter
youtube movie
youtube movie  how to get you tube movie in java please help me for code thanks in advance raman
Java Create a file that contains your favorite movie quote
Java Create a file that contains your favorite movie quote  Create a file that contains your favorite movie quote. Use a text editor such as Notepad... the user to enter the favorite movie quote. Then write it into the text file and Copy
Movie clip in flex
Movie clip in flex  Hi... What is a MovieClip? IUIMovieClip? please give me an example. Thanks   Ans: MovieClip: The MovieClip class... be either a MovieClip object or extend from the MovieClip class. While ActionScript can
Java class
Java class  What is the purpose of the Runtime class
java class
java class  write a java program to display a msg "window closing" when the user attempts to close the window.(a) create a window class (b) create frame within the window class (c) extends window adapter class to display the msg
java class
java class  please send me the answer of the question which i have send according of java class assoon as possible . Write a java program to display.... a. Create a window class. b. Create frame within the window class. c. Extend
MovieRating class - Java Beginners
the movie rating. 12.Create a MovieRating class that contains a private map... class to determine whether the child can watch the movie. 14.Add... minimum age allowed to watch movie rated PG *from MovieRating class
Java inner class and static nested class
Java inner class and static nested class  Java inner class and static nested class
Java Class Size
Java Class Size  How to determine size of java class
Java inner class
Java inner class  What are inner class and anonymous class
java class - Java Beginners
java class  How to run a java class( automatically in tomcat server for a particular time
class method in java
class method in java  How to write a class method in Java?   You must read Java - Class, Object and Methods in Java
Java dictionary class
Java dictionary class  What is the Dictionary class
Java adapter class
Java adapter class  What is adapter class
converting java class to java fx class
converting java class to java fx class   i am working on a java project which would convert text to speech and speech to text. i have developed a java file that would work for text to speech. it is working fine as a .java file
Example of HashMap class in java
Example of HashMap class in java. The HashMap is a class in java collection framwork. It stores values in the form of key/value pair. It is not synchronized
Java class file
Java class file  How do i open a java class file using eclipse
java anonymous class
java anonymous class  Can an anonymous class be declared as implementing an interface and extending a class
Java System class
Java System class  What is the purpose of the System class
abstact class - Java Beginners
abstact class  write a java program to implement an animal abstact class
Java math class
Java math class  Can you instantiate the Math class
java Math class
java Math class  Why are the methods of the Math class static
Java file class
Java file class  What is the purpose of the File class
Java abstract class
Java abstract class  Can an abstract class be final
Pyramid Multiplex Online movie ticket booking
Pyramid Multiplex Online movie ticket booking  Pyramid multiplex is setting up itsā?? online movie ticket booking to enhance the audience experience... to add movies for each theatre which contains movie name, star cast, director
java object class methods
java object class methods  What are the methods in Object class?  There are lots of methods in object class. the list of some methods are as- clone equals wait finalize getClass hashCode notify notifyAll
Java nested class example
Java nested class example  Give me any example of Nested Class.   Nested Class: Class defined within another class is called nested class. Nested class is divided into two parts- 1.Static 2.Non-static Static
What is Calendar class in Java?
What is Calendar class in Java?  Hi, What is Calendar class in Java? I want to learn about this class to make use of it in Java programs. Thanks   Hi, java.util.Calendar is an abstract class in Java and its static