tailieunhanh - Lecture Java methods: Object-oriented programming and data structures (3rd AP edition): Chapter 8 - Maria Litvin, Gary Litvin
Chapter 8 - Iterative statements: while, for, do–while. In this chapter, the learning objectives are: Understand the semantics and learn the Java syntax for while, for, and do-while loops; learn how to use nested loops. | Strings "Chapter 8" Copyright © 2015 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved. Java Methods Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin 3rd AP edition 8- Processing text is what computers do much of the time. Your Java compiler is one example of a program that does a lot of handling and parsing of strings. Handling strings is pretty straightforward and convenient in Java. Objectives: Learn about literal strings Learn about String constructors and commonly used methods Understand immutability of strings Learn to format numbers into strings and extract numbers from strings Learn several useful methods of the Character class Learn about the StringBuffer class 8- You might say that Strings are built into Java. There is no need to import because the package is imported automatically into all classes. Like the char type, String objects internally represent characters using Unicode. The String | Strings "Chapter 8" Copyright © 2015 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved. Java Methods Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin 3rd AP edition 8- Processing text is what computers do much of the time. Your Java compiler is one example of a program that does a lot of handling and parsing of strings. Handling strings is pretty straightforward and convenient in Java. Objectives: Learn about literal strings Learn about String constructors and commonly used methods Understand immutability of strings Learn to format numbers into strings and extract numbers from strings Learn several useful methods of the Character class Learn about the StringBuffer class 8- You might say that Strings are built into Java. There is no need to import because the package is imported automatically into all classes. Like the char type, String objects internally represent characters using Unicode. The String class An object of the String class represents a string of characters. The String class belongs to the package, which is built into Java. Like other classes, String has constructors and methods. Unlike other classes, String has two operators, + and += (used for concatenation). 8- The + and += operators for strings are an exception in Java, the only example of operators that work with objects. Literal Strings Literal strings are anonymous constant objects of the String class that are defined as text in double quotes. Literal strings don’t have to be constructed: they are “just there.” 8- This is one of the reasons why String constructors are not used very often: instead of constructing a string you just write a literal string. Literal Strings (cont’d) can be assigned to String variables. can be passed to methods and constructors as parameters. have methods you can call: String fileName = ""; button = new JButton("Next slide"); if ("Start".equals(cmd)) .
đang nạp các trang xem trước