Python programming problems
December 18, 2019
Sub-netting Worksheet
December 18, 2019

JAVA Program

JAVA Program

Reserved Words Reserved words are also called keywords. You may not redefine any of these reserved words. Their meanings are determined by the Java language and cannot be changed. In particular, you cannot use any of these reserved words for variable names, method names, or class names.

abstract false package void

assert final private volatile

finally protected

boolean float public while

break for

byte return

goto

case short

catch if static

char implements strictfp

class import super

const instanceof switch

continue int synchronized

interface

default this

do long throw

double throws

native transient

else new true

enum null try

extends

This page intentionally left blank

Operator Precedence In the following list, operators on the same line are of equal precedence. As you move down the list, each line is of lower precedence. When the order of operations is not dictated by parenthe- ses, the operator of higher precedence executes before an operator of lower precedence. When operators have equal precedence, binary operators execute in left-to-right order, and unary oper- ators execute in right-to-left order.

Highest Precedence The unary operators +, -, ++, –, !, ~ The unary operators new and (type) The binary operators *, /, % The binary operators +, – The binary (shift) operators <<, >>, >>> The binary operators <, >, <=, >= The binary operators ==, != The binary operator & The binary operator ^ The binary operator | The binary operator && The binary operator || The ternary (conditional) operator ? : Assignment operators =, *=, /=, %=, +=, -=, <<=, >>=, >>>=, &=, ^=, |= Lowest Precedence

Primitive Data Types

Type Size Values

Integer

byte 1 byte -128 to 127

short 2 bytes -32,768 to 32,767

int 4 bytes -2,147,483,648 to 2,147,483,647

long 8 bytes -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

Real

float 4 bytes -3.402824 x 1038 to 3.402824 x 1038

double 8 bytes -1.79769313486232 x 10308 to 1.79769313486232 x 10308

Character (Unicode)

char 2 bytes All Unicode values between 0 and 65,535

Boolean

boolean 1 bit true, false

Unicode Character Codes The printable characters shown are a subset of the Unicode character set known as the ASCII character set. The numbering is the same whether the characters are considered to be members of the Unicode character set or members of the ASCII character set. (Character number 32 is the blank.)

32 56 8 80 P 104 h

33 ! 57 9 81 Q 105 i

34 ” 58 : 82 R 106 j

35 # 59 ; 83 S 107 k

36 $ 60 < 84 T 108 l

37 % 61 = 85 U 109 m

38 & 62 > 86 V 110 n

39 ‘ 63 ? 87 W 111 o

40 ( 64 @ 88 X 112 p

41 ) 65 A 89 Y 113 q

42 * 66 B 90 Z 114 r

43 + 67 C 91 [ 115 s

44 , 68 D 92 \ 116 t

45 – 69 E 93 ] 117 u

46 . 70 F 94 ^ 118 v

47 / 71 G 95 _ 119 w

48 0 72 H 96 ‘ 120 x

49 1 73 I 97 a 121 y

50 2 74 J 98 b 122 z

51 3 75 K 99 c 123 {

52 4 76 L 100 d 124 |

53 5 77 M 101 e 125 }

54 6 78 N 102 f 126 ~

55 7 79 O 103 g

Data Structures and Abstractions with Java™

Third Edition

\

Frank M. Carrano University of Rhode Island

Prentice Hall Boston Columbus Indianpolis New York San Francisco Upper Saddle River

Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo

Editorial Director: Marcia Horton Editor in Chief: Michael Hirsch Acquisitions Editor: Tracy Dunkelberger Editorial Assistant: Stephanie Sellinger Director of Marketing: Patrice Jones Marketing Manager: Yezan Alayan Marketing Coordinator: Kathryn Ferranti Vice President, Production: Vince O’Brien Managing Editor: Jeff Holcomb Associate Managing Editor: Robert Engelhardt Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell

Cover Designer: Anthony Gemmellaro Photo Researcher: AV Manager, Rights and

Permissions: Karen Sanatar Cover Image Credit: © Color Symphony/

Shutterstock Media Editor: Dan Sandin Full-Service Project Management: GEX

Publishing Services Composition: GEX Publishing Services Printer/Binder: Edwards Brothers Cover Printer: Lehigh-Phoenix Color, Hagerstown

Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on the appropriate page within text.

Java is a trademark of the Oracle Corporation, 500 Oracle Parkway, Redwood Shores, CA 94065.

Copyright © 2012, 2007 and 2003 by Pearson Education, Inc., publishing as Prentice Hall. All rights reserved. Manufactured in the United States of America. This publication is protected by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to 201-236-3290.

Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed in initial caps or all caps.