Class Notes (979,443)
CA (576,659)
PROG 10082 (10)
Dancy (10)
Lecture 2

PROG 10082 Lecture 2: java lecture 2
Premium

4 Pages
112 Views
Winter 2016

Department
Computer Engineering Technology
Course Code
PROG 10082
Professor
Dancy
Lecture
2

This preview shows page 1. Sign up to view the full 4 pages of the document.
Java Strings Lecture
the first thing when a program is running would be "Please enter the first word"
ie hello
Mistakes in java code
-basically, pay attention to syntax and ensure consistency. Follow the rules for proper
syntax, make sure there's enough brackets
-a data type explains what kind of variable is represented
-to convert a number to scientific notation it's powers of ten
-123.456 is (10^2)*1.23 for example
-you need to get the number to one sigfig for scientific notation
-to write the above in exponential notation, replace the 10 with an e as 1.23456e2
-a float is half as precise as double
-you would represent a byte, in machine language, with an integer in java when you are
using a compiler
-strings must be in double quotations
-char uses one single quotation mark like ' '
-/n is newline
-a char literal can only have one character
Source code from class:
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
import.java.util.Scanner;
// this class takes in 3 words from the user and prints them out in reverse order
public class ReverseWords
{
public static void main(String [] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Please enter the first word");
String first=sc.nextLine();

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 Strings Lecture the first thing when a program is running would be Please enter the first word ie hello Mistakes in java code basically, pay attention to syntax and ensure consistency. Follow the rules for proper syntax, make sure theres enough brackets a data type explains what kind of variable is represented to convert a number to scientific notation its powers of ten 123.456 is (10^2)*1.23 for example you need to get the number to one sigfig for scientific notation to write the above in exponential notation, replace the 10 with an e as 1.23456e2 a float is half as precise as double you would represent a byte, in machine language, with an integer in java when you are using a compiler strings must be in double quotations char uses one single quotation mark like n is newline a char literal can only have one character Source code from class: * package whatever; dont place package name! * import java.util.*; import java.lang.*; import java.io.*; * Name of the class has to be Main only if the class is public. * class Ideone { public static void main (String[] args) throws java.lang.Exception { import.java.util.Scanner; this class takes in 3 words from the user and prints them out in reverse order public class ReverseWords { public static void main(String [] args) { Scanner sc=new Scanner(System.in); System.out.println(Please enter the first word); String first=sc.nextLine();
More Less
Unlock Document

Only page 1 are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

You've reached the limit of 4 previews this month

Create an account for unlimited previews.

Already have an account?

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