Class Notes (920,420)
CA (542,238)
PROG 10082 (10)
Dancy (10)
Lecture 3

PROG 10082 Lecture 3: Java Lecture 3
Premium

2 Pages
96 Views

Department
Computer Engineering Technology
Course Code
PROG 10082
Professor
Dancy

This preview shows half of the first page. Sign up to view the full 2 pages of the document.
Java Lecture 3
Classes define what objects look like, they implement things at design time, and objects
are created from classes at run time
visibility defines whether the objects are public or private
primitive type only has lowercase, and they are considered to be keywords
a variable is a class name
Circle biground= new Circle(); this creates and declares the variable
literals are constant values that appear in a program like they can be string or int or
double, it is a constant value
space is also a character
a) -8 b) 2..but isnt this supposed to be (8/9)*(2/1)=-9+16/9. No. It is an integer because it
is truncatied, so it is zero. therefore the right answer is -9
Invalid expressions:
6.0%2 is invalid
6**2 is invalid
1rimw is invalid unless it's a string literal
5/5/5 is valid but the result is zero
%f is float or double, %d or % i is integers
system.out.printf tells you how to format a value in float format
3.14159
%w.df by default the value shows 6 decimal places
if you want to format the thing as for example 5.3f, then you can allocate the number five
places
the value here for example is where w is 5, d is 3 for 3 decimal places, and is a float
printf tells us how to format
To Submit in .java files:
area of a sphere having the radius of 1.1
area=(4/3) pi*r^2
print the area to two decimal places
sphere
Convert cels to Farenheit, where C is 40
F=(9/5)*C+32
fahrenheit converter

Loved by over 2.2 million students

Over 90% improved by at least one letter grade.

Leah — University of Toronto

OneClass has been such a huge help in my studies at UofT especially since I am a transfer student. OneClass is the study buddy I never had before and definitely gives me the extra push to get from a B to an A!

Leah — University of Toronto
Saarim — University of Michigan

Balancing social life With academics can be difficult, that is why I'm so glad that OneClass is out there where I can find the top notes for all of my classes. Now I can be the all-star student I want to be.

Saarim — University of Michigan
Jenna — University of Wisconsin

As a college student living on a college budget, I love how easy it is to earn gift cards just by submitting my notes.

Jenna — University of Wisconsin
Anne — University of California

OneClass has allowed me to catch up with my most difficult course! #lifesaver

Anne — University of California
Description
Java Lecture 3 Classes define what objects look like, they implement things at design time, and objects are created from classes at run time visibility defines whether the objects are public or private primitive type only has lowercase, and they are considered to be keywords a variable is a class name Circle biground= new Circle(); this creates and declares the variable literals are constant values that appear in a program like they can be string or int or double, it is a constant value space is also a character a) 8 b) 2..but isnt this supposed to be (89)*(21)=9+169. No. It is an integer because it is truncatied, so it is zero. therefore the right answer is 9 Invalid expressions: 6.0
More Less
Unlock Document


Only half of the first page are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


OR

Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit