Studydroid is shutting down on January 1st, 2019

Bookmark and Share

Front Back
What two signatures does the String.startsWith method have?
(String prefix, int toffset)
(String prefix)
Which simpiler Socket constructor creates a connected socket?
Socket(InetAddress address, int port)
At a minimum what does the Socket.connect method need passed to it?
An endpoint of type SocketAddress (the server to be connected to.)
What happens if a char or String passed to the String.indexOf method is not found in the referenced String?
-1 is returned.
What two signatures does the String.replace method have?
(char oldChar, char newChar)
(CharSequence target, CharSequence replacement)
Which standard does the Currency class use?
ISO 4217
What is the SocketImpl class?
The abstract superclass of all classes that implement sockets.
How can you test if a socket is connected to a server?
isConnected() [return: boolean]
What number does the index of a character sequence start with?
A String's length can be accessed through its length instance variable.  (T/F)
False.  It can be accessed through the length() method.
What does the String.replace method do?
It returns a new string with all instances of the old chars or CharSequences replaced with the new.
What method do you start with in order to write to a Socket?
Which class performs the actual work of a Socket?
How can you determine the IP address of a Socket?
getInetAddress() [return: InetAddress]
What does Socket.bind(SocketAddress bindpoint) do?
It binds a socket to a local address.
What method do you start with in order to read from a Socket?
What parameter does the String.charAt method take?
An index number of type int. (int index)
Which package is imported automatically?
What does the String.endsWith(String suffix) method return?
A boolean value representing whether the referenced String ends with the suffix.
AWT was superceeded by which package?
What happens if you pass an index to String.charAt(int index) that is greater than length - 1?
An IndexOutOfBounds exception is thrown.
What version of Java first included the Socket class?
The Reader & Writer classes are part of which package?
What does the String.startWith method return?
A boolean value representing whether the referenced String starts with the prefix.
Which package produces heaveweight GUI components?
java.awt (Abstract Windowing Toolkit)
What are sockets?
The endpoints in communication between two machines.
What is the one parameter passed to the String.endsWith method?
(String suffix)
What four signatures does the String.indexOf method have?
(int ch)
(int ch, int fromIndex)
(String str)
(String str, int fromIndex)
What does String.charAt(int index) return?
A char that is the character at the specified index in the String.
What is the Socket class used for?
Implementing client sockets.
What does the String.substring method return?
A new String that is a substring of the referenced String object.
Which classes implement CharSequence?
String, StringBuffer, StringBuilder
What happens if the string referenced by the replace emthod does not contain any instances of the old char or CharSequence?
A reference to the original String is returned.
Which package does the String class belong to?
Name four different types of the Reader class.
BufferedReader, InputStreamReader, FilterReader, FileReader
How can you access the length of an array?
Through its length public data member.
Name four different types of the Writer class.
BufferedWriter, OutputStreamWriter, FilterWriter, FileWriter.
How do you close a Socket?
How can you test if a socket is closed?
isClose() [return: boolean]
What number does the String.length() method start with?
1 (ie not 0)
If a String has 5 characters, what will String.length() return?
What does the String.indexOf method return?
An int representing the index of the first occurence of a character or String in relationship to the referenced String object.
What is the package naming convention?
The use of reverse domain names separated by periods.  Use lowercase characters delimited with underscores.
How do you package a source file?
Place the package keyword followed by the package name at the beginning of the source file.  You also must ensure that the file structure matches the package declaration.
How many package declarations can you place in a source file?
0 or 1
How many import statements can you place in a source file?
0 to Unlimited.
How do you include Class files from a package in your source code?
You use the import keyword followed by the package name and class name.  Alternately, you can import all Classes from a package by specifying the package name followed by an asterisk.
Which package names are reserved by JavaSoft?
java.* and javax.*
Where are import statements placed in the source file?
After any package statement and before the Class declaration.
When were static imports first included in Java?
Java SE 5.0
x of y cards Next > >> >|