Search Here

Latest Java Dumps & java Tips

Enter your email address:

Delivered by FeedBurner

Monday, November 16, 2009

Sun Certified Developer for Java Web Services (CX-310-230) Exam Objectives

. Monday, November 16, 2009
0 comments



Exam Objectives

Section 1: XML Web Service Standards


  • Given XML documents, schemas, and fragments determine whether their syntax and form are correct (according to W3C schema) and whether they conform to the WS-I Basic Profile 1.1.
  • Describe the use of XML schema in J2EE Web services.


Section 2: SOAP 1.2 Web Service Standards


  • List and describe the encoding types used in a SOAP message.
  • Describe the SOAP Processing and Extensibility Model.
  • Describe SOAP Message Construct and create a SOAP message that contains an attachment.


Section 3: Describing and Publishing (WSDL and UDDI)


  • Explain the use of WSDL in Web services, including a description of WSDL's basic elements, binding mechanisms and the basic WSDL operation types as limited by the WS-I Basic Profile 1.1.
  • Describe how WSDL enables one to separate the description of the abstract functionality offered by a service from concrete details of a service description such as “how” and “where” that functionality is offered.
  • Describe the Component Model of WSDL including Descriptions, Interfaces, Bindings, Services and Endpoints.
  • Describe the basic functions provided by the UDDI Publish and Inquiry APIs to interact with a UDDI business registry.


Section 4: JAX-WS


  • Explain JAX-WS technology for building web services and client that communicate using XML.
  • Given a set of requirements for a Web service, such as transactional needs, and security requirements, design and develop Web service applications that use JAX-WS technology.
  • Describe the Integrated Stack (I-Stack) which consist of JAX-WS, JAXB, StAX, SAAJ.
  • Describe and compare JAX-WS development approaches.
  • Describe the features of JAX-WS including the usage of Java Annotations.
  • Describe the architecture of JAX_WS including the Tools SPI that define the contract between JAX-WS tools and Java EE.
  • Describe creating a Web Service using JAX-WS.
  • Describe JAX-WS Client Communications Models.
  • Given an set of requirements, design and develop a Web service client, such as a Java EE client and a stand-alone client, using JAX-WS.
  • Given a set of requirements, create and configure a Web service client that accesses a stateful Web service.


Section 5: REST, JSON, SOAP and XML Processing APIs (JAXP, JAXB and SAAJ)


  • Describe the characteristics of REST Web Services.
  • Describe the characteristics of JSON Web Services.
  • Compare SOAP web services to REST Web Services.
  • Compare SOAP web services to JSON Web Services.
  • Describe the functions and capabilities of the APIs included within JAXP.
  • Describe the functions and capabilities of JAXB, including the JAXB process flow, such as XML-to-Java and Java-to-XML, and the binding and validation mechanisms provided by JAXB.
  • Create and use a SOAP message with attachments using the SAAJ APIs.


Section 6: JAXR


  • Describe the function of JAXR in Web service architectural model, the two basic levels of business registry functionality supported by JAXR, and the function of the basic JAXR business objects and how they map to the UDDI data structures.
  • Create JAXR client to connect to a UDDI business registry, execute queries to locate services that meet specific requirements, and publish or update information about a business service.


Section 7: J2EE Web Services


  • Identify the characteristics of and the services and APIs included in the Java EE platform.
  • Explain the benefits of using the Java EE platform for creating and deploying Web service applications.
  • Describe the functions and capabilities of the JAXP, DOM, SAX, StAX, JAXR, JAXB, JAX-WS and SAAJ in the Java EE platform.
  • Describe the role of the WS-I Basic Profile when designing Java EE Web services.


Section 8: Security


  • Explain basic security mechanisms including: transport level security, such as basic and mutual authentication and SSL, message level security, XML encryption, XML Digital Signature, and federated identity and trust.
  • Identify the purpose and benefits of Web services security oriented initiatives and standards such as Username Token Profile, SAML, XACML, XKMS, WS-Security, and the Liberty Project.
  • Given a scenario, implement Java EE based web service web-tier and/or EJB-tier basic security mechanisms, such as mutual authentication, SSL, and access control.
  • Describe factors that impact the security requirements of a Web service, such as the relationship between the client and service provider, the type of data being exchanged, the message format, and the transport mechanism.
  • Describe WS-Policy that defines a base set of constructs that can be used and extended by other Web services specifications to describe a broad range of service requirements and capabilities.


Section 9: Developing Web Services


  • Describe the steps required to configure, package, and deploy Java EE Web services and service clients, including a description of the packaging formats, such as .ear, .war, .jar, annotations and deployment descriptor settings.
  • Given a set of requirements, develop code to process XML files using the SAX, StAX, DOM, XSLT, and JAXB APIs.
  • Given an XML schema for a document style Web service create a WSDL file that describes the service and generate a service implementation.
  • Given a set of requirements, create code to create an XML-based, document style, Web service using the JAX-WS APIs.
  • Implement a SOAP logging mechanism for testing and debugging a Web service application using Java EE Web Service APIs.
  • Given a set of requirements, create code to handle system and service exceptions and faults received by a Web services client.


Section 10: Web Services Interoperability Technologies


  • Describe WSIT, the features of each WSIT technology and the standards that WSIT.
  • Describe how to create a WSIT client from a Web Service Description Language (WSDL) file.
  • Describe how to configure Web Service providers and clients to use message optimization.
  • Create a Microsoft Windows Communication Foundation (WCF) client that accesses a Java Web Service.
  • Describes the best practices for production and consumption of data for interoperability between WCF Web Services and Java web service clients or between Java WebServices and WCF Web Service clients.


Section 11: General Design and Architecture


  • Describe the characteristics of a service-oriented architecture and how Web Services fit this model.
  • Given a scenario, design a Java EE Web Service using Web Services Design Patterns (Asynchronous Interaction, JMS Bridge, Web Service Cache, Web Serive Broker), and Best Practices.
  • Describe how to handle the various types of return values, faults, errors, and exceptions that can occur during a Web service interaction.
  • Describe the role that Web Services play when integrating data, application functions, or business processes in a Java EE application.


Endpoint Design and Architecture


  • Given a scenario, design Web Service applications using information models that are either procedure-style or document-style.
  • Describe the function of the service interaction and processing layers in a Web Service.
  • Design a Web Service for an asynchronous, document-style process and describe how to refactor a Web Service from a synchronous to an asynchronous model.
  • Describe how the characteristics, such as resource utilization, conversational capabilities, and operational modes, of the various types of Web service clients impact the design of a Web service or determine the type of client that might interact with a particular service.

Read More »»

Sun Certified Business Component Developer for the Java Platform, Enterprise Edition 5 (CX-310-091) Exam Objectives

.
0 comments


Exam Objectives

EJB 3.0 Overview


  • Identify the uses, benefits, and characteristics of Enterprise JavaBeans technology, for version 3.0 of the EJB specification.
  • Identify the APIs that all EJB 3.0 containers must make available to developers.
  • Identify correct and incorrect statements or examples about EJB programming restrictions.
  • Match the seven EJB roles with the corresponding description of the role's responsibilities.
  • Describe the packaging and deployment requirements for enterprise beans.
  • Describe the purposes and uses of annotations and deployment descriptors, including how the two mechanisms interact, how overriding is handled, and how these mechanisms function at the class, method, and field levels.


General EJB 3.0 Enterprise Bean Knowledge


  • Identify correct and incorrect statements or examples about the lifecycle of all 3.0 Enterprise Bean instances, including the use of the @PostConstruct and @PreDestroy callback methods.
  • Identify correct and incorrect statements or examples about interceptors, including implementing an interceptor class, the lifecycle of interceptor instances, @AroundInvoke methods, invocation order, exception handling, lifecycle callback methods, default and method level interceptors, and specifying interceptors in the deployment descriptor.
  • Identify correct and incorrect statements or examples about how enterprise beans declare dependencies on external resources using JNDI or dependency injection, including the general rules for using JNDI, annotations and/or deployment descriptors, EJB references, connection factories, resource environment entries, and persistence context and persistence unit references.
  • Identify correct and incorrect statements or examples about Timer Services, including the bean provider's view and responsibilities, the TimerService, Timer and TimerHandle interfaces, and @Timeout callback methods.
  • Identify correct and incorrect statements or examples about the EJB context objects that the container provides to 3.0 Session beans and 3.0 Message-Driven beans, including the security, transaction, timer, and lookup services the context can provide.
  • Identify correct and incorrect statements or examples about EJB 3.0 / EJB 2.x interoperability, including how to adapt an EJB 3.0 bean for use with clients written to the EJB 2.x API and how to access beans written to the EJB 2.x API from beans written to the EJB 3.0 API.


EJB 3.0 Session Bean Component Contract & Lifecycle


  • Identify correct and incorrect statements or examples that compare the purpose and use of Stateful and Stateless Session Beans.
  • Identify correct and incorrect statements or examples about remote and local business interfaces for Session Beans.
  • Write code for the bean classes of Stateful and Stateless Session Beans.
  • Identify correct and incorrect statements or examples about the lifecycle of a Stateful Session Bean including the @PrePassivate and @PostActivate lifecycle callback methods and @Remove methods.
  • Given a list of methods of a Stateful or Stateless Session Bean class, define which of the following operations can be performed from each of those methods: SessionContext interface methods, UserTransaction methods, access to the java:comp/env environment naming context, resource manager access, and other enterprise bean access.
  • Identify correct and incorrect statements or examples about implementing a session bean as a web service endpoint, including rules for writing a web service endpoint interface and use of the @WebService and @WebMethod annotations.
  • Identify correct and incorrect statements or examples about the client view of a session bean, including the client view of a session object's life cycle, obtaining and using a session object, and session object identity.


EJB 3.0 Message-Driven Bean Component Contract


  • Develop code that implements a Message-Driven Bean Class.
  • Identify correct and incorrect statements or examples about the interface(s) and methods a JMS Message-Driven bean must implement, and the required metadata.
  • Describe the use and behavior of a JMS message driven bean, including concurrency of message processing, message redelivery, and message acknowledgement.
  • Identify correct and incorrect statements or examples about the client view of a message driven bean.


Java Persistence API Entities


  • Identify correct and incorrect statements or examples about the characteristics of Java Persistence entities.
  • Develop code to create valid entity classes, including the use of fields and properties, admissible types, and embeddable classes.
  • Identify correct and incorrect statements or examples about primary keys and entity identity, including the use of compound primary keys.
  • Implement association relationships using persistence entities, including the following associations: bidirectional for @OneToOne, @ManyToOne, @OneToMany, and @ManyToMany; unidirectional for @OneToOne, @ManyToOne, @OneToMany, and @ManyToMany.
  • Given a set of requirements and entity classes choose and implement an appropriate object-relational mapping for association relationships.
  • Given a set of requirements and entity classes, choose and implement an appropriate inheritance hierarchy strategy and/or an appropriate mapping strategy.
  • Describe the use of annotations and XML mapping files, individually and in combination, for object-relational mapping.


Java Persistence Entity Operations


  • Describe how to manage entities, including using the EntityManager API and the cascade option.
  • Identify correct and incorrect statements or examples about entity instance lifecycle, including the new, managed, detached, and removed states.
  • Identify correct and incorrect statements or examples about EntityManager operations for managing an instance's state, including eager/lazy fetching, handling detached entities, and merging detached entities.
  • Identify correct and incorrect statements or examples about Entity Listeners and Callback Methods, including: @PrePersist, @PostPersist, @PreRemove, @PostRemove, @PreUpdate, @PostUpdate, and @PostLoad, and when they are invoked.
  • Identify correct and incorrect statements about concurrency, including how it is managed through the use of @Version attributes and optimistic locking.


Persistence Units and Persistence Contexts


  • Identify correct and incorrect statements or examples about JTA and resource-local entity managers.
  • Identify correct and incorrect statements or examples about container-managed persistence contexts.
  • Identify correct and incorrect statements or examples about application-managed persistence contexts.
  • Identify correct and incorrect statements or examples about transaction management for persistence contexts, including persistence context propagation, the use of the EntityManager.joinTransaction() method, and the EntityTransaction API.
  • Identify correct and incorrect statements or examples about persistence units, how persistence units are packaged, and the use of the persistence.xml file.
  • Identify correct and incorrect statements or examples about the effect of persistence exceptions on transactions and persistence contexts.


Java Persistence Query Language


  • Develop queries that use the SELECT clause to determine query results, including the use of entity types, use of aggregates, and returning multiple values.
  • Develop queries that use Java Persistence Query Language syntax for defining the domain of a query using JOIN clauses, IN, and prefetching.
  • Use the WHERE clause to restrict query results using conditional expressions, including the use of literals, path expressions, named and positional parameters, logical operators, the following expressions (and their NOT options): BETWEEN, IN, LIKE, NULL, EMPTY, MEMBER [OF], EXISTS, ALL, ANY, SOME, and functional expressions.
  • Develop Java Persistence Query Language statements that update a set of entities using UPDATE/SET and DELETE FROM.
  • Declare and use named queries, dynamic queries, and SQL (native) queries.
  • Obtain javax.persistence.Query objects and use the javax.persistence.Query API.


Transactions


  • Identify correct and incorrect statements or examples about bean-managed transaction demarcation.
  • Identify correct and incorrect statements or examples about container-managed transaction demarcation, and given a list of transaction behaviors, match them with the appropriate transaction attribute.
  • Identify correct and incorrect statements or examples about transaction propagation semantics.
  • Identify correct and incorrect statements or examples about specifying transaction information via annotations and/or deployment descriptors.
  • Identify correct and incorrect statements or examples about the use of the EJB API for transaction management, including getRollbackOnly, setRollbackOnly and the SessionSynchronization interfaces.


Exceptions


  • Identify correct and incorrect statements or examples about exception handling in EJB.
  • Identify correct and incorrect statements or examples about application exceptions and system exceptions in session beans and message-driven beans, and defining a runtime exception as an application exception.
  • Given a list of responsibilities related to exceptions, identify those which are the bean provider's, and those which are the responsibility of the container provider. Be prepared to recognize responsibilities for which neither the bean nor container provider is responsible.
  • Identify correct and incorrect statements or examples about the client's view of exceptions received from an enterprise bean invocation.
  • Given a particular method condition, identify the following: whether an exception will be thrown, the type of exception thrown, the container's action, and the client's view.


Security Management


  • Match security behaviors to declarative security specifications (default behavior, security roles, security role references, and method permissions).
  • From a list of responsibilities, identify which roles are responsible for which aspects of security: application assembler, bean provider, deployer, container provider, system administrator, or server provider.
  • Identify correct and incorrect statements or examples about use of the isCallerInRole and getCallerPrincipal EJB programmatic security APIs.
  • Given a security-related deployment descriptor tag or annotation, identify correct and incorrect statements and/or code related to that tag.

Read More »»

Sun Certified Web Component Developer for the Java Platform, Enterprise Edition 5 (CX-310-083): Exam Objectives

.
0 comments

Assignment Objectives

Section 1: The Servlet Technology Model


  • For each of the HTTP Methods (such as GET, POST, HEAD, and so on) describe the purpose of the method and the technical characteristics of the HTTP Method protocol, list triggers that might cause a Client (usually a Web browser) to use the method; and identify the HttpServlet method that corresponds to the HTTP Method.
  • Using the HttpServletRequest interface, write code to retrieve HTML form parameters from the request, retrieve HTTP request header information, or retrieve cookies from the request.
  • Using the HttpServletResponse interface, write code to set an HTTP response header, set the content type of the response, acquire a text stream for the response, acquire a binary stream for the response, redirect an HTTP request to another URL, or add cookies to the response.
  • Describe the purpose and event sequence of the servlet life cycle: (1) servlet class loading, (2) servlet instantiation, (3) call the init method, (4) call the service method, and (5) call destroy method.


Section 2: The Structure and Deployment of Web Applications


  • Construct the file and directory structure of a Web Application that may contain (a) static content, (b) JSP pages, (c) servlet classes, (d) the deployment descriptor, (e) tag libraries, (d) JAR files, and (e) Java class files; and describe how to protect resource files from HTTP access.
  • Describe the purpose and semantics of the deployment descriptor.
  • Construct the correct structure of the deployment descriptor.
  • Explain the purpose of a WAR file and describe the contents of a WAR file, how one may be constructed.


Section 3: The Web Container Model


  • For the ServletContext initialization parameters: write servlet code to access initialization parameters; and create the deployment descriptor elements for declaring initialization parameters.
  • For the fundamental servlet attribute scopes (request, session, and context): write servlet code to add, retrieve, and remove attributes; given a usage scenario, identify the proper scope for an attribute; and identify multi-threading issues associated with each scope.
  • Describe the Web container request processing model; write and configure a filter; create a request or response wrapper; and given a design problem, describe how to apply a filter or a wrapper.
  • Describe the Web container life cycle event model for requests, sessions, and web applications;create and configure listener classes for each scope life cycle; create and configure scope attribute listener classes; and given a scenario, identify the proper attribute listener to use.
  • Describe the RequestDispatcher mechanism; write servlet code to create a request dispatcher; write servlet code to forward or include the target resource; and identify and describe the additional request-scoped attributes provided by the container to the target resource.


Section 4: Session Management


  • Write servlet code to store objects into a session object and retrieve objects from a session object.
  • Given a scenario describe the APIs used to access the session object, explain when the session object was created, and describe the mechanisms used to destroy the session object, and when it was destroyed.
  • Using session listeners, write code to respond to an event when an object is added to a session, and write code to respond to an event when a session object migrates from one VM to another.
  • Given a scenario, describe which session management mechanism the Web container could employ, how cookies might be used to manage sessions, how URL rewriting might be used to manage sessions, and write servlet code to perform URL rewriting.


Section 5: Web Application Security


  • Based on the servlet specification, compare and contrast the following security mechanisms: (a) authentication, (b) authorization, (c) data integrity, and (d) confidentiality.
  • In the deployment descriptor, declare a security constraint, a Web resource, the transport guarantee, the login configuration, and a security role.
  • Compare and contrast the authentication types (BASIC, DIGEST, FORM, and CLIENT-CERT); describe how the type works; and given a scenario, select an appropriate type.


Section 6: The JavaServer Pages (JSP) Technology Model


  • Identify, describe, or write the JSP code for the following elements: (a) template text, (b) scripting elements (comments, directives, declarations, scriptlets, and expressions), (c) standard and custom actions, and (d) expression language elements.
  • Write JSP code that uses the directives: (a) 'page' (with attributes 'import', 'session', 'contentType', and 'isELIgnored'), (b) 'include', and (c) 'taglib'.
  • Write a JSP Document (XML-based document) that uses the correct syntax.
  • Describe the purpose and event sequence of the JSP page life cycle: (1) JSP page translation, (2) JSP page compilation, (3) load class, (4) create instance, (5) call the jspInit method, (6) call the _jspService method, and (7) call the jspDestroy method.
  • Given a design goal, write JSP code using the appropriate implicit objects: (a) request, (b) response, (c) out, (d) session, (e) config, (f) application, (g) page, (h) pageContext, and (i) exception.
  • Configure the deployment descriptor to declare one or more tag libraries, deactivate the evaluation language, and deactivate the scripting language. 6.7 Given a specific design goal for including a JSP segment in another page, write the JSP code that uses the most appropriate inclusion mechanism (the include directive or the jsp:include standard action).


Section 7: Building JSP Pages Using the Expression Language (EL)


  • Given a scenario, write EL code that accesses the following implicit variables including pageScope, requestScope, sessionScope, and applicationScope, param and paramValues, header and headerValues, cookie, initParam and pageContext.
  • Given a scenario, write EL code that uses the following operators: property access (the . operator), collection access (the [] operator).


Section 8: Building JSP Pages Using Standard Actions


  • Given a design goal, create a code snippet using the following standard actions: jsp:useBean (with attributes: 'id', 'scope', 'type', and 'class'), jsp:getProperty, jsp:setProperty (with all attribute combinations), and jsp:attribute.
  • Given a design goal, create a code snippet using the following standard actions: jsp:include, jsp:forward, and jsp:param.


Section 9: Building JSP Pages Using Tag Libraries


  • For a custom tag library or a library of Tag Files, create the 'taglib' directive for a JSP page.
  • Given a design goal, create the custom tag structure in a JSP page to support that goal.
  • Given a design goal, use an appropriate JSP Standard Tag Library (JSTL v1.1) tag from the "core" tag library.


Section 10: Building a Custom Tag Library


  • Describe the semantics of the "Classic" custom tag event model when each event method (doStartTag, doAfterBody, and doEndTag) is executed, and explain what the return value for each event method means; and write a tag handler class.
  • Using the PageContext API, write tag handler code to access the JSP implicit variables and access web application attributes.
  • Given a scenario, write tag handler code to access the parent tag and an arbitrary tag ancestor.
  • Describe the semantics of the "Simple" custom tag event model when the event method (doTag) is executed; write a tag handler class; and explain the constraints on the JSP content within the tag.
  • Describe the semantics of the Tag File model; describe the web application structure for tag files; write a tag file; and explain the constraints on the JSP content in the body of the tag.


Section 11: Java EE Patterns


  • Given a scenario description with a list of issues, select a pattern that would solve the issues. The list of patterns you must know are: Intercepting Filter, Model-View-Controller, Front Controller, Service Locator, Business Delegate, and Transfer Object.
  • Match design patterns with statements describing potential benefits that accrue from the use of the pattern, for any of the following patterns: Intercepting Filter, Model-View-Controller, Front Controller, Service Locator, Business Delegate, and Transfer Object.

Read More »»

SCJP 6.0 (CX-310-065) Exam Objectives

.
1 comments

Exam Objectives

Section 1: Declarations, Initialization and Scoping


  • Develop code that declares classes (including abstract and all forms of nested classes), interfaces, and enums, and includes the appropriate use of package and import statements (including static imports).
  • Develop code that declares an interface. Develop code that implements or extends one or more interfaces. Develop code that declares an abstract class. Develop code that extends an abstract class.
  • Develop code that declares, initializes, and uses primitives, arrays, enums, and objects as static, instance, and local variables. Also, use legal identifiers for variable names.
  • Given a code example, determine if a method is correctly overriding or overloading another method, and identify legal return values (including covariant returns), for the method.
  • Given a set of classes and superclasses, develop constructors for one or more of the classes. Given a class declaration, determine if a default constructor will be created, and if so, determine the behavior of that constructor. Given a nested or non-nested class listing, write code to instantiate the class.


Section 2: Flow Control


  • Develop code that implements an if or switch statement; and identify legal argument types for these statements.
  • Develop code that implements all forms of loops and iterators, including the use of for, the enhanced for loop (for-each), do, while, labels, break, and continue; and explain the values taken by loop counter variables during and after loop execution.
  • Develop code that makes use of assertions, and distinguish appropriate from inappropriate uses of assertions.
  • Develop code that makes use of exceptions and exception handling clauses (try, catch, finally), and declares methods and overriding methods that throw exceptions.
  • Recognize the effect of an exception arising at a specified point in a code fragment. Note that the exception may be a runtime exception, a checked exception, or an error.
  • Recognize situations that will result in any of the following being thrown: ArrayIndexOutOfBoundsException,ClassCastException, IllegalArgumentException, IllegalStateException, NullPointerException, NumberFormatException, AssertionError, ExceptionInInitializerError, StackOverflowError or NoClassDefFoundError. Understand which of these are thrown by the virtual machine and recognize situations in which others should be thrown programatically.


Section 3: API Contents


  • Develop code that uses the primitive wrapper classes (such as Boolean, Character, Double, Integer, etc.), and/or autoboxing & unboxing. Discuss the differences between the String, StringBuilder, and StringBuffer classes.
  • Given a scenario involving navigating file systems, reading from files, writing to files, or interacting with the user, develop the correct solution using the following classes (sometimes in combination), from java.io: BufferedReader, BufferedWriter, File, FileReader, FileWriter, PrintWriter, and Console.
  • Use standard J2SE APIs in the java.text package to correctly format or parse dates, numbers, and currency values for a specific locale; and, given a scenario, determine the appropriate methods to use if you want to use the default locale or a specific locale. Describe the purpose and use of the java.util.Locale class.
  • Write code that uses standard J2SE APIs in the java.util and java.util.regex packages to format or parse strings or streams. For strings, write code that uses the Pattern and Matcher classes and the String.split method. Recognize and use regular expression patterns for matching (limited to: . (dot), * (star), + (plus), ?, \d, \s, \w, [], ()). The use of *, +, and ? will be limited to greedy quantifiers, and the parenthesis operator will only be used as a grouping mechanism, not for capturing content during matching. For streams, write code using the Formatter and Scanner classes and the PrintWriter.format/printf methods. Recognize and use formatting parameters (limited to: %b, %c, %d, %f, %s) in format strings.


Section 4: Concurrency


  • Write code to define, instantiate, and start new threads using both java.lang.Thread and java.lang.Runnable.
  • Recognize the states in which a thread can exist, and identify ways in which a thread can transition from one state to another.
  • Given a scenario, write code that makes appropriate use of object locking to protect static or instance variables from concurrent access problems.


Section 5: OO Concepts


  • Develop code that implements tight encapsulation, loose coupling, and high cohesion in classes, and describe the benefits.
  • Given a scenario, develop code that demonstrates the use of polymorphism. Further, determine when casting will be necessary and recognize compiler vs. runtime errors related to object reference casting.
  • Explain the effect of modifiers on inheritance with respect to constructors, instance or static variables, and instance or static methods.
  • Given a scenario, develop code that declares and/or invokes overridden or overloaded methods and code that declares and/or invokes superclass, or overloaded constructors.
  • Develop code that implements "is-a" and/or "has-a" relationships.


Section 6: Collections / Generics


  • Given a design scenario, determine which collection classes and/or interfaces should be used to properly implement that design, including the use of the Comparable interface.
  • Distinguish between correct and incorrect overrides of corresponding hashCode and equals methods, and explain the difference between == and the equals method.
  • Write code that uses the generic versions of the Collections API, in particular, the Set, List, and Map interfaces and implementation classes. Recognize the limitations of the non-generic Collections API and how to refactor code to use the generic versions. Write code that uses the NavigableSet and NavigableMap interfaces.
  • Develop code that makes proper use of type parameters in class/interface declarations, instance variables, method arguments, and return types; and write generic methods or methods that make use of wildcard types and understand the similarities and differences between these two approaches.
  • Use capabilities in the java.util package to write code to manipulate a list by sorting, performing a binary search, or converting the list to an array. Use capabilities in the java.util package to write code to manipulate an array by sorting, performing a binary search, or converting the array to a list. Use the java.util.Comparator and java.lang.Comparable interfaces to affect the sorting of lists and arrays. Furthermore, recognize the effect of the "natural ordering" of primitive wrapper classes and java.lang.String on sorting.


Section 7: Fundamentals


  • Given a code example and a scenario, write code that uses the appropriate access modifiers, package declarations, and import statements to interact with (through access or inheritance) the code in the example.
  • Given an example of a class and a command-line, determine the expected runtime behavior.
  • Determine the effect upon object references and primitive values when they are passed into methods that perform assignments or other modifying operations on the parameters.
  • Given a code example, recognize the point at which an object becomes eligible for garbage collection, determine what is and is not guaranteed by the garbage collection system, and recognize the behaviors of the Object.finalize() method.
  • Given the fully-qualified name of a class that is deployed inside and/or outside a JAR file, construct the appropriate directory structure for that class. Given a code example and a classpath, determine whether the classpath will allow the code to compile successfully.
  • Write code that correctly applies the appropriate operators including assignment operators (limited to: =, +=, -=), arithmetic operators (limited to: +, -, *, /, %, ++, --), relational operators (limited to: <, <=, >, >=, ==, !=), the instanceof operator, logical operators (limited to: &, |, ^, !, &&, ||), and the conditional operator ( ? : ), to produce a desired result. Write code that determines the equality of two objects or two primitives.

Read More »»

Thursday, November 5, 2009

Polymorphism Example

. Thursday, November 5, 2009
0 comments

Polymorphism Example
For example, given a base class
shape
,
polymorphism enables the programmer to define
different
area
methods for any number of derived
classes, such as
circles
,
rectangles
and
triangles
.
No matter what shape an object is, applying the
area
method to it will return the correct results.
5

Read More »»

Polymorphism

.
0 comments

What is Polymorphism?
Generally, polymorphism refers to the ability to
appear in many forms
Polymorphism in a Java program
The ability of a reference variable to change

behavior according to what object instance it is
holding.
This allows multiple objects of different subclasses

to be treated as objects of a single super class,
while automatically selecting the proper methods to
apply to a particular object based on the subclass it
belongs to
4

Read More »»

Sunday, September 27, 2009

The Java Programming Language

. Sunday, September 27, 2009
0 comments


Although Java was designed for the network, its utility is not restricted to networks. Platform independence, network-mobility, and security are of prime importance in a networked computing environment, but you may not always find yourself facing network-oriented problems. As a result, you may not always want to write programs that are platform independent. You may not always want to deliver your programs across networks or limit their capabilities with security restrictions. There may be times when you use Java technology primarily because you want to get the advantages of the Java programming language.
As a whole, Java technology leans heavily in the direction of networks, but the Java programming language is quite general-purpose. The Java language allows you to write programs that take advantage of many software technologies:
  • object-orientation
  • multi-threading
  • structured error-handling
  • garbage collection
  • dynamic linking
  • dynamic extension
Instead of serving as a test bed for new and experimental software technologies, the Java language combines in a new way concepts and techniques that had already been tried and proven in other languages. These concepts and techniques make the Java programming language a powerful general-purpose tool that you can apply to a variety of situations, independent of whether or not they involve a network.
At the beginning of a new project, you may be faced with the question, "Should I use C++ (or some other language) for my next project, or should I use Java?" As an implementation language, Java has some advantages and some disadvantages over other languages. One of the most compelling reasons for using Java as a language is that it can enhance developer productivity. The main disadvantage is potentially slower execution speed.
Java is, first and foremost, an object-oriented language. One promise of object-orientation is that it promotes the re-use of code, resulting in better productivity for developers. This may make Java more attractive than a procedural language such as C, but doesn't add much value to Java over C++. Yet compared to C++, Java has some significant differences that can improve a developer's productivity. This productivity boost comes mostly from Java's restrictions on direct memory manipulation.
In Java, there is no way to directly access memory by arbitrarily casting pointers to a different type or by using pointer arithmetic, as there is in C++. Java requires that you strictly obey rules of type when working with objects. If you have a reference (similar to a pointer in C++) to an object of type Mountain, you can only manipulate it as a Mountain. You can't cast the reference to type Lava and manipulate the memory as if it were a Lava. Neither can you simply add an arbitrary offset to the reference, as pointer arithmetic allows you to do in C++. You can, in Java, cast a reference to a different type, but only if the object really is of the new type. For example, if the Mountain reference actually referred to an instance of class Volcano (a specialized type of Mountain), you could cast the Mountain reference to a Volcano reference. Because Java enforces strict type rules at run- time, you are not able to directly manipulate memory in ways that can accidentally corrupt it. As a result, you can't ever create certain kinds of bugs in Java programs that regularly harass C++ programmers and hamper their productivity.
Another way Java prevents you from inadvertently corrupting memory is through automatic garbage collection. Java has a new operator, just like C++, that you use to allocate memory on the heap for a new object. But unlike C++, Java has no corresponding delete operator, which C++ programmers use to free the memory for an object that is no longer needed by the program. In Java, you merely stop referencing an object, and at some later time, the garbage collector will reclaim the memory occupied by the object.
The garbage collector prevents Java programmers from needing to explicitly indicate which objects should be freed. As a C++ project grows in size and complexity, it often becomes increasingly difficult for programmers to determine when an object should be freed, or even whether an object has already been freed. This results in memory leaks, in which unused objects are never freed, and memory corruption, in which the same object is accidentally freed multiple times. Both kinds of memory troubles cause C++ programs to crash, but in ways that make it difficult to track down the exact source of the problem. You can be more productive in Java primarily because you don't have to chase down memory corruption bugs. But also, you can be more productive because when you no longer have to worry about explicitly freeing memory, program design becomes easier.
A third way Java protects the integrity of memory at run-time is array bounds checking. In C++, arrays are really shorthand for pointer arithmetic, which brings with it the potential for memory corruption. C++ allows you to declare an array of ten items, then write to the eleventh item, even though that tramples on memory. In Java, arrays are full-fledged objects, and array bounds are checked each time an array is used. If you create an array of ten items in Java and try to write to the eleventh, Java will throw an exception. Java won't let you corrupt memory by writing beyond the end of an array.
One final example of how Java ensures program robustness is by checking object references, each time they are used, to make sure they are not null. In C++, using a null pointer usually results in a program crash. In Java, using a null reference results in an exception being thrown.
The productivity boost you can get just by using the Java language results in quicker development cycles and lower development costs. You can realize further cost savings if you take advantage of the potential platform independence of Java programs. Even if you are not concerned about a network, you may still want to deliver a program on multiple platforms. Java can make support for multiple platforms easier, and therefore, cheaper.

Read More »»

Java Dumps Headline Animator