Week 1 Continued
Week 1 Continued COSC 236
Popular in Introduction to COSC 1
Popular in ComputerScienence
This page Class Notes was uploaded by Jessica Hutchinson on Monday February 8, 2016. The Class Notes belongs to COSC 236 at Towson University taught by Robert G. Eyer in Spring 2016. Since its upload, it has received 67 views. For similar materials see Introduction to COSC 1 in ComputerScienence at Towson University.
Reviews for Week 1 Continued
Clutch. So clutch. Thank you sooo much Jessica!!! Thanks so much for your help! Needed it bad lol
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 02/08/16
COSC 236 For loops Used to tell compiler to do something a certain number of times 0 If test condition never goes to false it becomes an infinite loop 0 Tests the loop counter variable against a limit 0 Uses comparison operators lt less than lt less than or equal to gt greater than gt greater than or equal to Example SystemoutprintquotTminus quot for int i 10 i gt 1 i Systemoutprinti quot quot Systemoutprintlnquotblastoff quot SystemoutprintlnquotThe endquot Output Tminus 10 9 8 7 6 5 4 3 2 1 blastoff The end Parts of a for loop For int I I lt 4 i Initialization l Xv Increment Test 7 Nested for loops A loop within a loop Outerloop prints lines horizarionally and inner loop prints it vertically For example SystemoutprintquotTminus quot for int i 10 i gt 1 i Systemoutprinti quot quot Systemoutprintlnquotblastoff quot SystemoutprintlnquotThe endquot Output Tminus 10 9 8 7 6 5 4 3 2 1 blastoff The end 0 Always make sure to have a counter otherwise loops are infinite 0 String concentration using a plus symbol between a string and a variable value to make a longer string EX the value of j is j Output the value of j is 25 0 Methods are used to create multiple occurrences like functions in C Lab Notes Building Java Programs Chapter 1 Lab Handout Systemoutprintln 1 Hello quotDoubleSlashquot magazine I m confused by your publication Should I use a slash or a slash Respectfully Harold J Prescott quotHarryquot Program public class Test public static void mainString args Systemoutprint1n quotCan you explain to me the differencequot Systemoutprint1nquotbetween using a 39 and a quot or between a quot and a quotquot Systemoutprint1nquotOne is What is seen When typing a program but thequot Systemoutprint1nquotother is What always appears on the quotconsolequotquot Static Methods 3 I am method 2 I am method 1 I am method 1 I am method 1 I am method 3 I am method 2 I am method 1 I am method 1 k k k k k k 4 The program for the following drawings is gtlltgtllt COSC 236181 Jessica Hutchinson Drawings With Triangles Lab 1 public class Drawings public static void mainString args pointDownTriangleO middleO pointUpTrianglGO Systemoutprintln pointUpTrianglGO pointDownTriangleO pointUpTrianglGO Systemoutprintln middleO pointDownTriangleO middleO Systemoutprintln Systemoutprintln SystemoutprintlnquotDone With drawingsquot public static void pointUpTriangle Systemoutprintlnquot quot Systemoutprintlnquot quot Systemoutprintlnquot quot public static void middlc Systemoutprint1nquotquot Systemoutprint1nquot quot Systemoutprint1nquotquot public static void pointDownTriangle Systemoutprint1nquot quot Systemoutprint1nquot quot Systemoutprint1nquot quot
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'