Archive for the 'hrvatski' Category

[ Team LiB ] 3 Operators and Assignments

Sunday, February 4th, 2007

[ Team LiB ] Page 644
Note: If you are looking for best hosting provider to host and run your tomcat application check Astra tomcat hosting services

[ Team LiB ] 3 Operators and Assignments

Sunday, February 4th, 2007

[ Team LiB ] 4 Declarations and Access Control 4.1 public class EditContext { private Object selected; public void setSelected(Object newSelected) { selected = newSelected; } public Object getSelected() { return selected; } } 4.2 public interface Tool { public void setContext(EditContext newContext); public boolean isActive(); } 4.3 // Filename: Database.java // Specify package package com.megabankcorp.system; // Allow usage of Account class simply by referring to the name Account. import com.megabankcorp.records.Account; // Class must be abstract since it has abstract methods. public abstract class Database { // Abstract and available from anywhere. public abstract void deposit(Account acc, long amount); // Abstract and available from anywhere. public abstract void withdraw(Account acc, long amount); // Abstract and only available from package and subclasses. protected abstract long amount(Account acc); // Unmodifiable and only available from package. final void transfer(Account from, Account to, long amount) { withdraw(from, amount); deposit(to, amount); } } Page 645
Note: If you are looking for best hosting provider to host and run your tomcat application check Astra tomcat hosting services

[ Team LiB ] 1 Basics of Java

Sunday, February 4th, 2007

[ Team LiB ] Page 642
Note: If you are looking for good and quality webspace to host and run your java application check professional java hosting services

[ Team LiB ] 1 Basics of Java

Sunday, February 4th, 2007

[ Team LiB ] 1 Basics of Java Programming No programming exercises. [ Team LiB ] Page 640
Note: If you are looking for good and quality webspace to host and run your java application check professional java hosting services

[ Team LiB ] 1 Basics of Java

Sunday, February 4th, 2007

[ Team LiB ] 2 Language Fundamentals 2.1 The following program will compile and run without errors: package com.acme; // Correct ordering of package and importstatements. import java.util.*; public class Exercise1 { int counter; // This is rather useless public static void main(String[] args) { // Correct main signature Exercise1 instance = new Exercise1(); instance.go(); } public void go() { int sum = 0; // We could just as well have written sum = 100// here and removed the if statement below. int i = 0; while (i<100) { if (i == 0) sum = 100; sum = sum + i; i++; } System.out.println(sum); } } 2.2 The following program will compile and run without errors: // Filename: Temperature.java/* Identifiers and keywords in Java are case-sensitive. Therefore, the case of the file name must match the class name, the keywords must all be written in lowercase. The name of the String class has acapital S. The main method must be static and take an array ofString objects as an argument. */ public class Temperature { public static void main(String[] args) { // Correct method signaturedouble fahrenheit = 62.5; // /* identifies the start of a "starred" comment. // */ identifies the end. /* Convert */ double celsius = f2c(fahrenheit); Page 641
Note: If you are looking for good and quality webspace to host and run your java application check professional java hosting services

Page 637

Sunday, February 4th, 2007

[ Team LiB ] Page 638
Note: If you are looking for cheapest and affordable webspace to host and run your servlet application check Astra j2ee hosting services

Page 637

Sunday, February 4th, 2007

[ Team LiB ] Appendix E. Solutions to Programming Exercises Section 1. Basics of Java Programming Section 2. Language Fundamentals Section 3. Operators and Assignments Section 4. Declarations and Access Control Section 5. Control Flow, Exception Handling, and Assertions Section 6. Object-oriented Programming Section 7. Nested Classes and Interfaces Section 8. Basics of Java Programming Section 9. Threads Section 10. Fundamental Classes Section 11. Collections and Maps [ Team LiB ] Page 639
Note: If you are looking for cheapest and affordable webspace to host and run your servlet application check Astra j2ee hosting services

Page 637

Sunday, February 4th, 2007

Page 637
Note: If you are looking for cheapest and affordable webspace to host and run your servlet application check Astra j2ee hosting services

[ Team LiB ] Page 634

Saturday, February 3rd, 2007

[ Team LiB ] Page 634

Hint: This post is supported by Gama web hosting php mysql provider

[ Team LiB ] Page 634

Saturday, February 3rd, 2007

[ Team LiB ] 11 Collections and Maps 11.1 (a), (d), and (e) Set, Collection and Map are core interfaces in the collections framework. LinkedList is a class that implements the List interface. There is no class or interface named Bag. 11.2 (b) and (e) The java.util package provides map implementations named HashMap and TreeMap. It does not provide any implementations named HashList, ArraySet, and ArrayMap. 11.3 (d) The List interface is implemented by collections that maintain sequences of possibly non-unique elements. Elements retain their ordering in the sequence. Collection classes implementing SortedSet only allow unique elements that are maintained in a sorted order. 11.4 (a) and (c) Some operations on a collection may throw an UnsupportedOperationException. This exception type is unchecked, and the code is not required to explicitly handle unchecked exceptions. A List allows duplicate elements. An ArrayList implements a resizable array. The capacity of the array will be expanded automatically when needed. The List interface defines a get() method, but there is no method by that name in the Collection interface. 11.5 (d) The program will compile without error, and will print all primes below 25 when run. All the collection implementations used in the program implement the Collection interface. The implementation instances are interchangeable when denoted by Collection references. None of the operations performed on the implementations will throw an UnsupportedOperationException. The program finds the primes below 25 by removing all values divisible by 2, 3, and 5 from the set of values from 2 through 25. Page 635

Hint: This post is supported by Gama web hosting php mysql provider