9_9%20Java%20Style%2c%20Type%20Conversion%2c%20Literals

9_9%20Java%20Style%2c%20Type%20Conversion%2c%20Literals -...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3330
Background image of page 1

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

View Full DocumentRight Arrow Icon
Homework 1 Due Monday 11:55PM Class names must start with uppercase - Collatz.java Factors.java - Reverse.java Cipher.java Read from a file called <ProblemName>.in - Scanner fin = new Scanner(new File(“Collatz.in”)) Output to standard output (the screen) - System.out.println(“Sample answer”)
Background image of page 2
Topics Java Basics: Comments, type conversion, literals
Background image of page 3

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

View Full DocumentRight Arrow Icon
Comments Comments are ignored by the compiler Line comments - // This is a line comment Eclipse/Javadoc Comments - /** Eclipse comment here */ Block comments - /* This is a block comment */
Background image of page 4
Comments Why comment? - For others - For yourself When to comment? - Before a class definition Describe the purpose of the class and important things to know about it
Background image of page 5

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

View Full DocumentRight Arrow Icon
Comments When to comment? - Before a method definition Describe the purpose of the method, the meaning of the formal parameters, and the meaning of the return value - Before variable declarations Describe the purpose of your variables - Mixed in with code Explain what your code is doing and why
Background image of page 6
Comments Write comments that give a good feeling for what is actually happening and why Consider: for(i = 0; i < n; i++) score[i] -= minValue; - Okay comment: // Re-scale the scores - Bad comment: // Loop from 0 to n - Really bad comment: // Sort the array
Background image of page 7

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

View Full DocumentRight Arrow Icon
Comments Choose descriptive variable names - Good: int numberOfVertices; - Good: double angularVelocity; - Bad: int foo; - Bad: String bar;
Background image of page 8
Naming Conventions Class names should begin with an uppercase
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/21/2011 for the course COP 3330 taught by Professor Staff during the Fall '08 term at University of Central Florida.

Page1 / 28

9_9%20Java%20Style%2c%20Type%20Conversion%2c%20Literals -...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online