Java: Delete Blanks - Solution
This page discusses - Java: Delete Blanks - Solution.
Java: Programming: Initials 2 - Answer
This page discusses - Java: Programming: Initials 2 - Answer.
Java: String Exercise 1c
This page discusses - Java: String Exercise 1c.
Java: String Exercise 1b
This page discusses - Java: String Exercise 1b.
Java: String Exercise 1a
This page discusses - Java: String Exercise 1a.
Java: TokenizeExpr.java
This page discusses - Java: TokenizeExpr.java.
Java: Regex Exercises 1
This page discusses - Java: Regex Exercises 1.
Java: Boolean Expression Answers
This page discusses - Java: Boolean Expression Answers.
Java: Numeric Expression Answers
This page discusses - Java: Numeric Expression Answers.
Java: Collections Class
This page discusses - Java: Collections Class.
Java: Example - Count occurences
Problem: Count the number of times one string is found in another..
Java: Example - String sort
Java: Example - String sort.
Java: Example - Palindrome test
Java: Example - Palindrome test.
Java: Example - Change Extension
Problem: Change the extension of a file name.
Java: Example - Count vowels
This example method counts all vowels (a, e, i, o, u) in a string..
Java: Example - Words to array
Java: Example - Words to array.
Java: String Exercise 2
String Exercise 2.
Variable Names
Basic variable naming conventions.
Shadowing this
When an inner class refers to this, it refers to the current instance of the inner class..
Shadow variables are evil
The inner variable shadows the outer variable..
Local/Instance/Class Variables
There are three kinds of Java variables..
Variables
Variables are places in memory to store values..
Exercise - Trim Right
Write a method that returns a string with all trailing blanks from the right end of its string parameter..
Programming - reverse() method
Write a method which has one parameter, a string, which returns a string which is the parameter will all characters reversed..
Programming - Replace method
The predefined Java function replace may not be used for this -- you have to write it yourself..
Exercise - Palindrome
Write a method which returns true if the string parameter is a palindrome..
Exercise - Pad Left
Write a method to return a string which is the parameter with add extra blanks to the left end to make it length width..
Programming - max3() method
Write a method which has three double parameters and returns the largest value..
Exercise - Count Words
Write a method which counts the number of words in a string..
Programming - countVowels() method
Write a method which has one parameter, a string, and it returns the int number of vowels (a e i o u) in the string..
Programming - Count Vowels - main
Write a program that reads a string and displays the number of vowels in it..
Exercise - Count Words
Write a method which counts the number of words in a string. Assume that a word is defined as a sequence of letters..
Exercise - Delete Blanks
Write a method to delete all blanks from its parameter..
Programming - World Peace
Change all occurences of "war" to "peace".
Programming: Initials 2
Write a program that asks for a name, including both first and last name, and displays the initials..
Programming: Initials 1
Write a program that asks for names and displays the initials..
Programming - Transform Name
Write a program to redisplay a name, possibly transformed.
Programming - Transform Name - Answer
Solution to: Write a program to redisplay a name, possibly transformed..
Programming - Transform Name - GUI 0
Write a GUI program to redisplay a name, possibly transformed..
Capitalize - Solution
Capitalize programming exercise..
Exercise - Capitalize
Write a method, capitalize, which takes one string parameter and returns a string ..
Exercise - Capitalize Words
Write a method which which returns a string first letter in every word capitalized and every other letter in lowercase..
Programming - Flip Name
Write a method, flipName, which has a string parameter which contains a name in last, first format..
String Exercises 1
(10 points) Given the following local variable declarations:.
String Exercise 2 - Answers
Assume the following:> String s, t, h, a; String n, e.
String Exercises 1 - Answers
Answers to the String Exercises 1..
Converting Strings to Numbers
To convert a string value to a number (for example, to convert the String value in a text field to an int), use these methods.
Converting Numbers to Strings
Converting Anything to String describes how to convert objects to String..
Converting Anything to String
Converting any data to strings is easy..
Example - Replace word
Write a method to replaces all occurences a word in a string with another word..