Fichas
Java

Fichas del conjunto (33)
- 1OverloadingDefining the same method name with different arguments.
- 2OverridingDefining the same method name with the same arguments.
- 3GettersGet the values of instance variables.
- 4SettersSetter Methods directly access and alter instance variables.
- 5Creating a Class.public class name
{
} - 6Instance VariablesVariables that will be used in the class. Will be initialized in the constructor.
- 7Constructorpublic name(arguments)
{
super();
variable1 = x;
variable2 = y;
} - 8Object Diagram

- 9Concatentationreturn x + y;
return " " + x.method() + y.method();
return "this is a string" + z.method(); - 10SuperclassUsed to specify common behavior exhibited by subclasses of the same superclass.
- 11PolymorphisimHaving the same messages sent to different objects, which perform their own behavior.
- 12InterfacesUsed when classes are otherwise unrelated but their instances have a common set of messages to which they must respond.
- 13EncapsulationA class that defines both attributes(variables) and methods that allow interaction with the variables. Combination of both data and operations within a single object is encapsulation.
- 14PublicCan be accessed by any class
- 15PrivateCan only be accessed by the class it is in.
- 16Abstract ClassDefines common message protocols and instance variables for it sub classes but which you cannot use to create objects,
- 17PersistenceSaving data in a non-volatile form, which can be achieved by saving it to a file.
- 18FileReaderBufferedReader bufferedFileReader = new BufferedReader(new FileReader(aFile);
- 19FileWriterBufferedWriter bufferedFileWriter = new BufferedWriter(new FileWriter(aFile));
- 20lineScannerlineScanner = new Scanner(BufferedReader.nextLine);
- 21DelimiterlineScanner.useDelimiter(",");
- 22Comparable1.To be able to compare objects.
2.To be able to sort into ascending or descending order.
3. Enforces a protocol on classes that implement it.
4. If using TreeSet the class must implement Comparable. - 23iterating through a listfor (String x: XList)
{
statements
} - 24iterating with indexingfor(int x = 0; xindex < xList.size(); xindex++)
{
statements
} - 25create mapMap variableName;
- 26SetsSet variable;
Setvariable = new SetType<>(); - 27variable reference diagram

- 28SubstitutabilityWhere a subclass type is compatible with the superclass type. Making it legal to assign an object to a variable declared to be of the type of it direct or indirect superclass.
- 29Formal argument and actual argumentaddName(string newName) is the formal argument used in the method.
names.addName("James") is the actual argument used in sending a message. - 30Sequence diagram

- 31Design by contract exampleThe amount that debit() has received (as an argument) is to be deducted from the account’s balance, provided there is at least that amount of money already in the account and the amount received to be deducted is a positive value. After this the method is to return true.
If the above conditions for the amount to be deducted and balance are not met, the method returns false. - 32new line writingString newLine = System.getProperty("line.separator");
- 33ReadingWhile(depends on if currentline has been declared)
lineScanner = new Scanner(currentLine);
lineScanner.useDelimiter(",");
Información
- Descripción
- Fichas sobre Java, creado por James Macaulay el 31/05/2015.
- Creado por
- James Macaulay
- Visitas
- 2
- Valoración