The document discusses key concepts in Java including classes, objects, fields, methods, variables, primitive types, reference types, and memory management. It explains that classes are the basic building blocks in Java programs and contain fields and methods. Objects are instances of classes that exist in memory. The document also covers variable scope, default initialization, and garbage collection in Java.
OCP Java (OCPJP) 8 Exam Quick Reference CardHari kiran G
If you are preparing to appear for Oracle Certified Professional Java SE 8 Programmer (OCPJP 8) certification exam, this a reference card (sort of long cheat sheet) meant to help you. You may want to print this reference card for your easy and quick reference when you prepare for your exam.
This presentation provides an overview of oracle's associate and professional Java certifications - gives you ideas on how to prepare and crack the exam with ease.
Access our sample Java8 certification questions.
1z0-808 certification questions ready to be used.
For each 1z0-808 certification question you can find the solution, the explanation and the exam objective of 1z0-808
OCP Java (OCPJP) 8 Exam Quick Reference CardHari kiran G
If you are preparing to appear for Oracle Certified Professional Java SE 8 Programmer (OCPJP 8) certification exam, this a reference card (sort of long cheat sheet) meant to help you. You may want to print this reference card for your easy and quick reference when you prepare for your exam.
This presentation provides an overview of oracle's associate and professional Java certifications - gives you ideas on how to prepare and crack the exam with ease.
Access our sample Java8 certification questions.
1z0-808 certification questions ready to be used.
For each 1z0-808 certification question you can find the solution, the explanation and the exam objective of 1z0-808
This document provides relevant and useful information about Java strings. It covers a brief description about strings and how to create a string in Java. It also covers detailed information on String, StringBuffer, and StringBuilder classes and differences between them.
OCA Java SE 8 Exam Chapter 6 Exceptionsİbrahim Kürce
A program can fail for just about any reason. Here are just a few possibilities:
The code tries to connect to a website, but the Internet connection is down.
You made a coding mistake and tried to access an invalid index in an array.
One method calls another with a value that the method doesn't support.
Spring Data is a high level SpringSource project whose purpose is to unify and ease the access to different kinds of persistence stores, both relational database systems and NoSQL data stores.
Java 8 is coming soon. In this presentation I have outlined the major Java 8 features. You get information about interface improvements, functional interfaces, method references, lambdas, java.util.function, java.util.stream
OCA Java SE 8 Exam Chapter 5 Class Designİbrahim Kürce
Inheritance is the process by which the new child subclass automatically includes any public or protected primitives, objects, or methods defined in the parent class.
We refer to any class that inherits from another class as a child class, or a descendent of that class.
We refer to the class that the child inherits from as the parent class, or an ancestor of the class.
Java is a high-level programming language developed by Sun Microsystems. ... Instead, Java programs are interpreted by the Java Virtual Machine, or JVM, which runs on multiple platforms. This means all Java programs are multiplatform and can run on different platforms, including Macintosh, Windows, and Unix computers.
Here I discuss about Java programming language and easiest way to solve programming problem. Java basic syntax and their uses are described briefly so that anyone can easily understand within very short time. If anyone follow the slide with proper way,I assure that he or she will find java programming interesting.
This document provides relevant and useful information about Java strings. It covers a brief description about strings and how to create a string in Java. It also covers detailed information on String, StringBuffer, and StringBuilder classes and differences between them.
OCA Java SE 8 Exam Chapter 6 Exceptionsİbrahim Kürce
A program can fail for just about any reason. Here are just a few possibilities:
The code tries to connect to a website, but the Internet connection is down.
You made a coding mistake and tried to access an invalid index in an array.
One method calls another with a value that the method doesn't support.
Spring Data is a high level SpringSource project whose purpose is to unify and ease the access to different kinds of persistence stores, both relational database systems and NoSQL data stores.
Java 8 is coming soon. In this presentation I have outlined the major Java 8 features. You get information about interface improvements, functional interfaces, method references, lambdas, java.util.function, java.util.stream
OCA Java SE 8 Exam Chapter 5 Class Designİbrahim Kürce
Inheritance is the process by which the new child subclass automatically includes any public or protected primitives, objects, or methods defined in the parent class.
We refer to any class that inherits from another class as a child class, or a descendent of that class.
We refer to the class that the child inherits from as the parent class, or an ancestor of the class.
Java is a high-level programming language developed by Sun Microsystems. ... Instead, Java programs are interpreted by the Java Virtual Machine, or JVM, which runs on multiple platforms. This means all Java programs are multiplatform and can run on different platforms, including Macintosh, Windows, and Unix computers.
Here I discuss about Java programming language and easiest way to solve programming problem. Java basic syntax and their uses are described briefly so that anyone can easily understand within very short time. If anyone follow the slide with proper way,I assure that he or she will find java programming interesting.
CETPA Infotech provides Core and Advanced Java Training in Noida. We have a team of experienced Java professionals who help our students learn Java with the help of Live Base Projects. The object-oriented, class-based build of Java has made it one of most popular programming languages and the demand of professionals with certification in Advanced Java training is at an all-time high not just in India but foreign countries too
Introduction of Object Oriented Programming Language using Java. .pptxPoonam60376
The slide contains the Introduction of Object Oriented Programming Language using Java. It covers basics of OOP, Inheritance,Polymorphism, Exception etc.
Effective Java - Madde 2: Birçok parametreli yapılandırıcıyla karşılaşırsan k...İbrahim Kürce
Statik fabrikalar ve yapılandırıcılar ortak bir kısıtı paylaşır: birçok isteğe bağlı parametreye karşı kendilerini iyi ölçekleyemezler. Paketli gıdaların üzerinde bulunan Beslenme Unsurları(Nutrition Facts) sınıfının gösterilmesi ele alalım. Bu sınıfın birkaç tane zorunlu alanı vardır: porsiyon boyutu(serving size), konteyner başına porsiyon(servings per container) ve porsiyon başına kalorileri(calories per serving). Ayrıca birçok isteğe bağlı alanı vardır: toplam yağ(total fat), doymuş yağ(saturated fat), kolesterol, sodyum vb. Birçok ürün için bu alanların değerleri sıfırdan farklıdır.
Effective Java - Madde 1: Yapılandırıcılar yerine statik fabrika(factory) met...İbrahim Kürce
Normal şekilde, sınıfı kullanan kişi, o sınıftan bir örnek oluşturabilme iznini public(herkese açık) yapılandırıcı sayesinde elde eder. Her programcının bilmesi gereken başka bir teknik daha vardır. Bir sınıf, kendi örneğini döndüren statik fabrika metodu ile de örneğini oluşturabilir. Boolean(basit boolean tipinin kutulanmış sınıf hali) sınıfından basit bir örnek.
Effective Java - Chapter 4: Classes and Interfacesİbrahim Kürce
Classes and interfaces lie at the heart of the Java programming language. They are its basic units of abstraction.
This chapter contains guidelines to help you make the best use of these elements so that your classes and interfaces are usable, robust, and flexible.
Effective Java - Chapter 3: Methods Common to All Objectsİbrahim Kürce
Although object is a concrete class, it is designed primarily for extension.
All of its nonfinal methods (equals, hashCode, toString, clone, and finalize) have explicit general contracts because they are designed to be overridden.
This chapter tells you when and how to override the nonfinal Object methods. The finalize method is omitted from this chapter because it was discussed in Item 7. While not an Object method, Comparable.compareTo is discussed in this chapter because it has a similar character.
Effective Java - Chapter 2: Creating and Destroying Objectsİbrahim Kürce
Creating and Destroying Objects: This chapter concerns creating and destroying objects: when and how to create them, when and how to avoid creating them, how to ensure they are destroyed in a timely manner, and how to manage any cleanup actions that must precede their destruction.
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaYara Milbes
Discover the transformative power of the WhatsApp API in our latest SlideShare presentation, "Top 7 Unique WhatsApp API Benefits." In today's fast-paced digital era, effective communication is crucial for both personal and professional success. Whether you're a small business looking to enhance customer interactions or an individual seeking seamless communication with loved ones, the WhatsApp API offers robust capabilities that can significantly elevate your experience.
In this presentation, we delve into the top 7 distinctive benefits of the WhatsApp API, provided by the leading WhatsApp API service provider in Saudi Arabia. Learn how to streamline customer support, automate notifications, leverage rich media messaging, run scalable marketing campaigns, integrate secure payments, synchronize with CRM systems, and ensure enhanced security and privacy.
Launch Your Streaming Platforms in MinutesRoshan Dwivedi
The claim of launching a streaming platform in minutes might be a bit of an exaggeration, but there are services that can significantly streamline the process. Here's a breakdown:
Pros of Speedy Streaming Platform Launch Services:
No coding required: These services often use drag-and-drop interfaces or pre-built templates, eliminating the need for programming knowledge.
Faster setup: Compared to building from scratch, these platforms can get you up and running much quicker.
All-in-one solutions: Many services offer features like content management systems (CMS), video players, and monetization tools, reducing the need for multiple integrations.
Things to Consider:
Limited customization: These platforms may offer less flexibility in design and functionality compared to custom-built solutions.
Scalability: As your audience grows, you might need to upgrade to a more robust platform or encounter limitations with the "quick launch" option.
Features: Carefully evaluate which features are included and if they meet your specific needs (e.g., live streaming, subscription options).
Examples of Services for Launching Streaming Platforms:
Muvi [muvi com]
Uscreen [usencreen tv]
Alternatives to Consider:
Existing Streaming platforms: Platforms like YouTube or Twitch might be suitable for basic streaming needs, though monetization options might be limited.
Custom Development: While more time-consuming, custom development offers the most control and flexibility for your platform.
Overall, launching a streaming platform in minutes might not be entirely realistic, but these services can significantly speed up the process compared to building from scratch. Carefully consider your needs and budget when choosing the best option for you.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Utilocate offers a comprehensive solution for locate ticket management by automating and streamlining the entire process. By integrating with Geospatial Information Systems (GIS), it provides accurate mapping and visualization of utility locations, enhancing decision-making and reducing the risk of errors. The system's advanced data analytics tools help identify trends, predict potential issues, and optimize resource allocation, making the locate ticket management process smarter and more efficient. Additionally, automated ticket management ensures consistency and reduces human error, while real-time notifications keep all relevant personnel informed and ready to respond promptly.
The system's ability to streamline workflows and automate ticket routing significantly reduces the time taken to process each ticket, making the process faster and more efficient. Mobile access allows field technicians to update ticket information on the go, ensuring that the latest information is always available and accelerating the locate process. Overall, Utilocate not only enhances the efficiency and accuracy of locate ticket management but also improves safety by minimizing the risk of utility damage through precise and timely locates.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
Essentials of Automations: The Art of Triggers and Actions in FME
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
1. OCA EXAM 8
CHAPTER 1 – Java Building Blocks
By İbrahim Kürce
Brief of OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808
Jeanne Boyarsky, Scott Selikoff
2. CHAPTER 1
Info About Exam
The OCA exam has varied between 60 and 90 questions since it was
introduced. The score to pass has varied between 60 percent and 80
percent. The time allowed to take the exam has varied from two hours to
two-and-a-half hours.
http://www.selikoff.net/java-oca-8-programmer-i-study-guide/
Some testing centers are nice and professionally run. Others stick you in a
closet with lots of people talking around you.
3. Chapter 1 – Java Building Blocks
In Java programs, classes are the basic building blocks.
When defining a class, you describe all the parts and characteristics of one
of those building blocks.
An object is a runtime instance of a class in memory.
All the various objects of all the different classes represent the state of your
program.
4. Fields and Methods
Java classes have two primary elements: methods, often called functions or
procedures in other languages, and fields, more generally known as
variables.
Together these are called the members of the class.
Variables hold the state of the program, and methods operate on that
state.
Java calls a word with special meaning a keyword.
The public keyword on line 1 means the class can be used by other classes.
The class keyword indicates you're defining a class.
5. Fields and Methods
Animal gives the name of the class.
This one has a special return type called void.
void means that no value at all is returned.
This method requires information be supplied to it from the calling method; this
information is called a parameter.
The full declaration of a method is called a method signature.
6. Comments
Another common part of the code is called a comment. Because
comments aren't executable code, you can place them anywhere.
// comment until end of line
/* Multiple
* line comment
*/
/**
* Javadoc multiple-line comment
* @author Jeanne and Scott
*/
7. Comments
This comment is similar to a multiline comment except it starts with /**. This
special syntax tells the Javadoc tool to pay attention to the comment.
8. Comments
anteater is in a multiline comment. Everything between /* and */ is part of a
multiline comment— even if it includes a single-line comment within it!
bear is your basic single-line comment.
cat and dog are also single-line comments. Everything from // to the end of
the line is part of the comment, even if it is another type of comment.
elephant is your basic multiline comment.
The line with ferret is interesting in that it doesn't compile. Everything from
the first /* to the first */ is part of the comment, which means the compiler
sees something like this: /* */ */
We have a problem. There is an extra */. That's not valid syntax— a fact the
compiler is happy to inform you about.
9. Classes vs. Files
You can put two classes in the same file. When you do so, at most one of
the classes in the file is allowed to be public.
If you do have a public class, it needs to match the filename.
Code would not compile in a file named Animal2.java. It would be
Animal.java
10. Writing a main() Method
A Java program begins execution with its main() method.
A main() method is the gateway between the startup of a Java process,
which is managed by the Java Virtual Machine (JVM).
To compile Java code, the file must have the extension .java. The name of
the file must match the name of the class. The result is a file of bytecode by
the same name, but with a .class filename extension.
11. Writing a main() Method
Bytecode consists of instructions that the JVM knows how to execute.
Notice that we must omit the .class extension to run Zoo.java because the
period has a reserved meaning in the JVM.
The keyword public is what's called an access modifier.
The keyword static binds a method to its class so it can be called by just the
class name, as in, for example, Zoo.main().
The keyword void represents the return type. A method that returns no data
returns control to the caller silently. In general, it's good practice to use void
for methods that change an object's state.
14. Willcards
It doesn't import child packages, fields, or methods; it imports only classes.
You might think that including so many classes slows down your program,
but it doesn't. The compiler figures out what's actually needed.
There's one special package in the Java world called java.lang.
You can still type this package in an import statement, but you don't have
to.
15. Naming Conflicts
A common example of this is the Date class. Java provides
implementations of java.util.Date and java.sql.Date.
When the class is found in multiple packages, Java gives you the compiler
error:
The type Date is ambiguous
If you explicitly import a class name, it takes precedence over any
wildcards present.
16. Creating a New Package
Up to now, all the code we've written in this chapter has been in the default
package.
17. Creating a New Package
cd C: temp
javac packagea/ ClassA.java packageb/ ClassB.java
java packageb.ClassB
18. Code Formatting on Exam
You should expect to see code like the following and to be asked whether
it compiles.
19. Creating Objects
Constructors
To create an instance of a class, all you have to do is write new before it.
For example:
Random r = new Random();
There are two key points to note about the constructor: the name of the
constructor matches the name of the class, and there's no return type.
When you see a method name beginning with a capital letter and having
a return type, pay special attention to it. It is not a constructor since there's
a return type.
21. Instance Initializer Blocks
When you learned about methods, you saw braces ({}). The code between
the braces is called a code block.
Code blocks appear outside a method. These are called instance
initializers.
22. Order of Initialization
Fields and instance initializer blocks are run in the order in which they
appear in the file. The constructor runs after all fields and instance initializer
blocks have run.
23. Order of Initialization
Order matters for the fields and blocks of code. You can't refer to a
variable before it has been initialized:
{ System.out.println( name); } // DOES NOT COMPILE
private String name = "Fluffy"; //Five.
24. Distinguishing Between Object References and
Primitives - Primitive Types
Java has eight built-in data types, referred to as the Java primitive types.
float and double are used for floating-point (decimal) values.
A float requires the letter f following the number so Java knows it is a float.
byte, short, int, and long are used for numbers without decimal points.
Each numeric type uses twice as many bits as the smaller similar type. For
example, short uses twice as many bits as byte does.
25. Primitive Types
You won't be asked about the exact sizes of most of these types.
You do not have to know this for the exam, but the maximum number an
int can hold is 2,147,483,647.
How do we know this? One way is to have Java tell us:
System.out.println( Integer.MAX_VALUE);
When a number is present in the code, it is called a literal.
By default, Java assumes you are defining an int value with a literal.
long max = 3123456789; // DOES NOT COMPILE
long max = 3123456789L; // now Java knows it is a long
26. Primitive Types
octal (digits 0– 7), which uses the number 0 as a prefix— for example, 017
hexadecimal (digits 0– 9 and letters A– F), which uses the number 0
followed by x or X as a prefix— for example, 0xFF
binary (digits 0– 1), which uses the number 0 followed by b or B as a prefix—
for example, 0b10
Feature added in Java 7.
int million1 = 1000000;
int million2 = 1_000_000;
27. Reference Types
A reference type refers to an object (an instance of a class).
Unlike primitive types that hold their values in the memory where the
variable is allocated, references do not hold the value of the object they
refer to. Instead, a reference “points” to an object by storing the memory
address where the object is located, a concept referred to as a pointer.
Unlike other languages, Java does not allow you to learn what the physical
memory address is.
java.util.Date today;
The today variable is a reference of type Date and can only point to a
Date object.
28. Reference Types
A reference can be assigned to another object of the same type.
A reference can be assigned to a new object using the new keyword.
29. Key Differences
int value = null; // DOES NOT COMPILE
Primitives do not have methods declared on them.
int len = 1;
int bad = len.length(); // DOES NOT COMPILE
All the primitive types have lowercase type names. All classes that come
with Java begin with uppercase.
30. Declaring and Initializing Variables
A variable is a name for a piece of memory that stores data.
String zooName;
int numberAnimals;
zooName = "The Best Zoo";
numberAnimals = 100;
String zooName = "The Best Zoo";
int numberAnimals = 100;
31. Declaring Multiple Variables
String s1, s2;
String s3 = "yes", s4 = "no";
int num, String value; // DOES NOT COMPILE
Multiple variables of different types in the same statement is not allowed.
32. Identifiers
It probably comes as no surprise that Java has precise rules about identifier
names.
There are only three rules to remember for legal identifiers:
The name must begin with a letter or the symbol $ or _.
Subsequent characters may also be numbers.
You cannot use the same name as a Java reserved word.
33. Identifiers
const and goto aren't actually used in Java. They are reserved so that people
coming from other languages don't use them by accident— and in theory, in
case Java wants to use them one day.
Legal examples,
okidentifier
$OK2Identifier
_alsoOK1d3ntifi3r
__SStillOkbutKnotsonice$
Not legal ones,
3DPointClass // identifiers cannot begin with a number
hollywood@ vine // @ is not a letter, digit, $ or _
*$coffee // * is not a letter, digit, $ or _
34. Identifiers
Java has conventions in writing code that is CamelCase. In CamelCase,
each word begins with an uppercase letter. This makes multiple-word
variable names easier to read. Which would you rather read: Thisismyclass
name or ThisIsMyClass name?
35. Understanding Default Initialization of
Variables – Local Variables
A local variable is a variable defined within a method.
Local variables must be initialized before use.
The compiler is also smart enough to recognize initializations that are more
complex.
36. Instance and Class Variables
Variables that are not local variables are known as instance variables or
class variables.
Instance variables are also called fields.
Class variables are shared across multiple objects. You can tell a variable is
a class variable because it has the keyword static before it.
Instance and class variables do not require you to initialize them. As soon as
you declare these variables, they are given a default value.
37. Understanding Variable Scope
There are two local variables in this method. bitesOfCheese is declared
inside the method. piecesOfCheese is called a method parameter. It is also
local to the method.
Both of these variables are said to have a scope local to the method.
This means they cannot be used outside the method.
38. Understanding Variable Scope
Local variables— in scope from declaration to end of block
Instance variables— in scope from declaration until object garbage
collected
Class variables— in scope from declaration until program ends
39. Ordering Elements in Class
Think of the acronym PIC (picture): package, import, and class.
Multiple classes can be defined in the same file, but only one of them is
allowed to be public.
40. Ordering Elements in Class
The public class matches the name of the file.
A file is also allowed to have neither class be public. As long as there isn't
more than one public class in a file, it is okay.
41. Destroying Objects
Java provides a garbage collector to automatically look for objects that
aren't needed anymore.
All Java objects are stored in your program memory's heap.
The heap, which is also referred to as the free store, represents a large pool
of unused memory allocated to your Java application.
42. Garbage Collection
Garbage collection refers to the process of automatically freeing memory on
the heap by deleting objects that are no longer reachable in your program.
There are many different algorithms for garbage collection, but you don't need
to know any of them for the exam.
You do need to know that System.gc() is not guaranteed to run, and you should
be able to recognize when objects become eligible for garbage collection.
It meekly suggests that now might be a good time for Java to kick off a
garbage collection run. Java is free to ignore the request.
An object is no longer reachable when one of two situations occurs:
The object no longer has any references pointing to it.
All references to the object have gone out of scope.
43. finalize()
Java allows objects to implement a method called finalize() that might get
called.
Just keep in mind that it might not get called and that it definitely won't be
called twice.
44. Benefits of Java
Java has some key benefits that you'll need to know for the exam:
Object Oriented
Encapsulation: Java supports access modifiers to protect data from unintended
access and modification.
Platform Independent: Java is an interpreted language because it gets compiled
to bytecode. This is known as “write once, run everywhere.” On the OCP exam,
you'll learn that it is possible to write code that does not run everywhere. For
example, you might refer to a file in a specific directory.
Robust: One of the major advantages of Java over C + + is that it prevents
memory leaks. Java manages memory on its own and does garbage collection
automatically.
Simple: Java was intended to be simpler than C + +.
Secure: Java code runs inside the JVM.