CSE cheatsheet1 - 1..Thismethodiscalled? MainMethod...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1. A java application always contains a single method.  This method is called? Give the signature of this method. Main Method Public static void main (String[] args) 2. How is date given to this parameter? Through a command line interface.  For Example:  java someCompiledClass Data 3. Single line comments are preceded by what identifier?    //   Multiple line comments?   /*      */ 4. Identifiers can only begin with…?   Letters, underscores, dollar sign. 5.  What does API stand for?   Application Programmer Interface 6.  What needs to be done to use the scanner class?   Import java.util.Scanner; 7.  How do you print “Hello World”?     System.out.println(“Hello World”); 8.   What is Encapsulation?   The hiding of design in a computer program that are most likely to chance,  thus protecting other parts of the program to change if the design decision is changed. 9. What are the three visibility modifiers, and what is their scope? + public – can be accessed from anywhere - private – can only be accessed from inside the class # protected – can only be accessed within its own package, and by a subclass of its class in another package. 10. What is the purpose of toString()? To give a human readable representation of the object 11.  What is an accessor method? An accessor method can be defined to access private variable in the class  since private data cannot be accessed from outside the class. 12.  What is a mutator method?   A mutator method can be defined to modify private variable in the class. 13. What is a constructor? A special method that is used to create a new object. 14.Define a constructor with two perameters int x, x for the class Point. Public Point(int x, int y) { this.x = x; this.y = y;} 15.  What is the difference between an instance variable and a local variable? Instance variables are global to all  methods of the class, local variables are only visible to the method scope in which its defined.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern