New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Computer Programming II

by: Agustina Price

Computer Programming II COP 3337

Agustina Price
GPA 3.6

Jainendra Navlakha

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Jainendra Navlakha
Class Notes
25 ?




Popular in Course

Popular in Computer Programming

This 20 page Class Notes was uploaded by Agustina Price on Monday October 12, 2015. The Class Notes belongs to COP 3337 at Florida International University taught by Jainendra Navlakha in Fall. Since its upload, it has received 6 views. For similar materials see /class/221730/cop-3337-florida-international-university in Computer Programming at Florida International University.


Reviews for Computer Programming II


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: 10/12/15
COT 3530 Data Structures Giri Namsimhan E65 389 Phone x3748 gir39icsfiuedu wwwcsfiuedugir39iTeach35305pr39ingO4h rm Evaluation MidTerm amp Final Exams Programming AssignmenTs Class Par ricipa rion 01132004 Lecture 1 What is Java Java programming language objec rorien red similar To C Java pla rform Java VirTual Machine JVM ApplicaTion Programming InTerface API Crea red and licensed by Sun Microsys rems Bo rh compiled and i n rerpre red compiler produces Java ByTecodes byTecodes are execuTed by Java VirTual Machine programs run sli thy slower Than naTive code such as Tha r produced by C 01132004 Lecture 1 3 What is Java Java Developmen r Ki r JDK compiler run rime sys rem debugger documen ra rion Java Vir rual Machine J VM execu res Java by recode programs 39 Java API a large collec rion of readymade sof rware componen rs rha r provide many useful capabili ries such as graphical user in rerface GUI widge rs The Java API is grouped i n ro libraries of rela red classes and in rerfaces rhese libraries are known as packages 01132004 Lecture 1 How Can Java be Used Wri re sof rware on one pla rform and run if on another applicaTions Crea re programs To run wi rhin a web browser apple rs Develop serverside applica rions for online forums s rores polls processing HTML forms and more Wri re applica rions for cell phones Twoway pagers and o rher consumer devices 01132004 Lecture 1 5 Programming Environment JDK 131 JCr ea ror is our39 editor and In regr a red Development Environmen r IDE Filenames casesensi rive Sour ce files java Compiled code class Projec r files All java source files musT be in some dir ec ror y 01132004 Lecture 1 J Creator Files Workspace file Hellojcw Project file Hellojcp Source Code Hellojovo List of source files A workspace may contain multiple projects A project may contain multiple java source files sr39che otxt Compiled code class file Hellocoss 01132004 Lecture 1 Simple Java Hello 1 Hellojava public class Hello public static void mainString args SystemoutprintlnquotHello COP 3337quot 01132004 Lecture 1 Simple Java Hello 2 Cr39eaTe The projecT File New EmpTy projecT ProjecT name Hello Workspace cr39eaTed auTomaTically Cr39eaTe The source file File New Java file File name Hello Build The projecT Build Compile projecT F7 ExecuTe The projecT Build ExecuTe projecT F5 01132004 Lecture 1 39 Figure 12 The eight primitive types in Java PRIMITIVE TYPE WHAT IT STORES RANGE byte 8bit integer 128 to 127 Short 16 bit integer 32768 to 32767 int 32 bit integer 2i47483648 to 2147483647 long 64 bit integer 263 to 263 1 float 32 bit oating point 6 signi cant digits 10 46 1038 double 64 bit oating point 15 signi cant digits 10 324 10308 char Unicode character boolean Boolean variable false and true 01132004 Lecture 1 10 Data Structures amp Problem Solving using JAVA2E Mark Allen Weiss 2002 Addison Wesley Primitive Types 8 primiTive Types byTe shorT inT long foaT double char boolean NonprimiTive Types are all reference Types reference Types are simply poinTers assignmenTs To reference Types declaring an objecT 5 creaTing an objecT garbage collecTion reference Types as parameTers of meThods casTing STring Type concaTenaTion engTh comparison subsTring conversion 01132004 Lecture 1 11 Static Declarations S ror39age alloca rion for39 s ra ric objec rs fields me rhods 2 ways To invoke s ra ric fields Sl me rhods using an objec r or39 using The class name 01132004 Lecture 1 12 Arrays Reference Types explicile cr39ea red using new s ra remen r Index s rar39Ts 0T 0 Ar39r39ays have leng rh field Ar39r39ay assignmen r ar39r39ay copy Ar39r39ay copy done using clone mul ridimensional ar39r39ays Dynamic ar39r39ays au roma ric using Ar39r39ayLis r 01132004 Lecture 1 13 import javaiolnputStreamReader importjavaioBufferedReader import javaiolOException public class ReadStrings Figure 26 27 page 4243 public static void main String args String array getStrings for inti 0 i lt arraylength iH Systemoutprintln array i Read an unlimited number of String return a String public static String getStrings BufferedReader in new BufferedReader new lnputStreamReader Systemin String array new String 5 int item sRead 0 String oneLine i Systemoutprintln quotEnter any number of strings one per line quot Systemoutprintln quotTerminate with empty line quot Implementing arrays of Strings try while oneLine in readLine null ampamp loneLineequals quot if itemsRead arraylength array resize array arraylength 2 array itemsRead oneLine catch lOException e System outprintln quotUnexpectele Exception has shortened amount read Systemoutprintln quotDone readingquot return resize array itemsRead Figure 27 page 43 Resize a String array return new array public static String resize String array int neWSize String original array int numToCopy Mathmin origina11ength newSize array new String neWSize for int i 0 i lt numToCopy i a1ray i origina1 i return array 01132004 Lecture 1 Swne program but using class ArrayList 01132004 import javaioInputStreamReader import javaioBufferedReader import javaioIOException import javautilArrayList ublic class ReadStrin sWithArra List I g y Figure 28 page 44 public static void main String args ArrayList array getStrings for inti 0 i lt arraysize i System0utprintln array get i Read an unlimited number of String return an ArrayList public static ArrayList getStrings BufferedReader in new BufferedReader new InputStreamReader System in ArrayList array new ArrayList String oneLine System0utprintln quotEnter any number of strings one per line quot System0utprintln quotTerminate with empty line quot try while oneLine inreadLine null ampamp 0neLineequals quotquot arrayadd oneLine catch IOException e System0utprintln quotUnexpected IO Exception has shortened amount read System0utprintln quotDone readingquot return array Exceptions amp Errors An excepTion is an objecT ThaT is Thrown from The siTe of an error and can be caughT by an appropriaTe excepTion handler SeparaTing The handler from error deTecTion makes The code easier To read and wriTe Do noT use excepTion as a quotcheapquot goTo sTaTemenT BeTTer To pass iT on To calling procedure More reliable error recovery wiThouT simply exiTing Userdefined excepTions can be creaTed or Thrown The Try region is a guarded region from which errors can be caughT by excepTions Errors are virTual machine problems OuTOfMemoryError InTernalError UnknownError are examples of errors Errors are uncrecoverable and should noT be caughT 01132004 Lecture 1 17 Figure 212 Common standard runtime exceptions STANDARD RUN TIME EXCEPTION MEANING ArithmeticException NumberFormetException IndexOutUtBoundsException Megative rraySizeException NullPointerException SecurityException Over ow or integer division by zero illegal conversion of String to numeric type illegal index into an arrayr or String Attempt to create a negative length array illegal attempt to use a null reference Runtime security violation 01132004 Lecture 1 18 Data Structures amp Problem Solving using JAVA2E Mark Allen Weiss 2002 Addison Wesley Figure 213 Common standard checked exceptions SIRNDARD CHECKED Exceenow MEANING java 10 EOFException java10FileN0tF0undExcept10n java 1010Except170n InterruptedException Endof 1e before rcompletion of input File not found to open 1nc ludes most 110 exceptions Thrown by the 1hreadsleep method 01132004 Lecture 1 19 Data Structures amp Problem Solving using JAVA2E Mark Allen Weiss 2002 Addison Wesley Input Output S rr39eams are used for39 IO Terminal IO heated in The same way as File IO Predefined s rreams Sys remi n Sys remou r Systemer39r39 r39eadLine and S rr ianokenizer39 are useful me rhods for39 forma r red i npu r They are par r of iavaioBuffer39edReader39 and iavau rilS rr39ianokenizer39 r39espec rively 01132004 Lecture 1 20


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


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'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Allison Fischer University of Alabama

"I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.