This document provides an overview of the Java programming language, including its structure, keywords, data types, variables, operators, expressions, statements, and control flow structures. It discusses the structure of Java programs, including classes, packages, and the main method. It also covers Java APIs, documentation, errors, and examples of basic Java programs.
Mahika Tutorials sharing PPT slide for core java programming language. Go threw this slide and visit our YouTube page too
https://www.youtube.com/c/mahikatutorials
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 presentation is ideal for a beginner of Java or someone who wants to brush up their Java Knowledge. It's simple to understand and well organized in a way most of the area in core Java has been covered.
Mahika Tutorials sharing PPT slide for core java programming language. Go threw this slide and visit our YouTube page too
https://www.youtube.com/c/mahikatutorials
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 presentation is ideal for a beginner of Java or someone who wants to brush up their Java Knowledge. It's simple to understand and well organized in a way most of the area in core Java has been covered.
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.
Programming Fundamentals With OOPs Concepts (Java Examples Based)indiangarg
This presentation gives you various types of programming models, A clear concept of object oriented languages, Classes and Object Concept, Different types of programming paradigms, program tokens, statements, expressions, Concepts of Inheritance, Encapsulation, Abstraction, Polymorphism, Interface etc.
This extensive course covers all the topics which will definitely make you a Java Superstar. You can do almost anything in Java after this course. You will surely be a better programmer and better still a Elegant programmer after this course.
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.
Programming Fundamentals With OOPs Concepts (Java Examples Based)indiangarg
This presentation gives you various types of programming models, A clear concept of object oriented languages, Classes and Object Concept, Different types of programming paradigms, program tokens, statements, expressions, Concepts of Inheritance, Encapsulation, Abstraction, Polymorphism, Interface etc.
This extensive course covers all the topics which will definitely make you a Java Superstar. You can do almost anything in Java after this course. You will surely be a better programmer and better still a Elegant programmer after this course.
My Beginners Perl tutorial, much abbreviated and as presented at the London Perl Workshop on Dec 1st 2007.
Also includes the section on Regular Expressions that we didn't have time for on the day.
oops concept in java | object oriented programming in javaCPD INDIA
object oriented programming is a key concept for the development of application in windows as well as web based application environment. oops concept maps real world through its concept of classes, objects, inheritance, polymorphism which help in making a robust application.
This Presentation is the intro. to java programming.
This presentation contain the basics of Java with example in simple language.
This presentation clear your all concept about programming in java and then you can easily make programs in java.
C++ Basics introduction to typecasting Webinar Slides 1Ali Raza Jilani
This Webinar is conduct by Learn 4 Earn Team
(Ali Raza Jilani & Hamza Ashraf)
In this Webinar Students can Prepare Mid Terms Exam of C++ and Insha Allah they will Get best Grades.
in the first discuss about Basics of C++
You can be Able to improve your Basics because if you have Strong basics then you can solve a big problem ion finger tips.
I hope you will learn much more new today
Every value in Java has a data type. Java supports two kinds of data types: primitive data types and reference data types. Primitive data types represent atomic, indivisible values. Java has eight Numeric data types: byte, short, int,
An operator is a symbol that is used to perform some type of computation on its operands. Java contains a rich set of
operators. Operators are categorized as unary, binary, or ternary based on the number of operands they take. They are categorized as arithmetic, relational, logical, etc. based on the operation they perform on their operands.
long, float, double, char, and boolean. Literals of primitive data types are constants. Reference data types represent
references of objects in memory. Java is a statically typed programming language. That is, it checks the data types of all values at compile time.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
22. Java Language Keywords abstract continue for new switch assert default goto package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super while
23.
24.
25.
26.
27.
28.
29.
30. Ranges of the Integral Primitive Types Type Size Minimum Maximum byte 8 bits -2 7 2 7 – 1 short 16 bits -2 15 2 15 – 1 int 32 bits -2 31 2 31 – 1 long 64 bits -2 63 2 63 – 1
31.
32. Ranges of the Floating-Point Primitive Types Type Size Minimum Maximum float 32 bits +/- 1.40 -45 +/- 3.40 +38 double 64 bits +/- 4.94 -324 +/- 1.79 +308 char 16 bits 0 2 16 - 1
41. Variables, Declarations, and Assignments – Examples public class Assignments { public static void main(String args []) { int x, y; // declare int variables float z = 3.414f; // declare and assign float double w = 3.1415; // declare and assign double boolean b = true; // declare and assign boolean char ch; // declare character variable String str; // declare String variable String s = "bye"; // declare and assign String ch = 'A'; // assign a value to char variable str = "Hi out there!"; // assign value to String x = 6; // assign value to int variable y = 1000; // assign values to int variable ... } }
58. If Statement – Example public static void main(String[] args) { int radius = 5; double surface = Math.PI * radius * radius; if (surface > 100) { System.out.println("The circle is too big!"); } else if (surface > 50) { System.out.println( "The circle has acceptable size!"); } else { System.out.println( "The circle is too small!"); } }
59.
60. The switch Statement – Example int dayOfWeek = 3; switch (dayOfWeek) { case 1: System.out.println("Monday"); break; case 2: System.out.println("Tuesday"); break; ... default: System.out.println("Invalid day!"); break; }
74. Scanner – Example import java.util.Scanner; public class ScannerDemo { public static void main(String[] args) { Scanner console = new Scanner(System.in); // Get the first input System.out.print("What is your name? "); String name = console.nextLine(); // Get the second input System.out.print("How old are you? "); int age = console.nextInt(); // Display output on the console System.out.println("Hello, " + name + ". " + "Next year, you'll be " + (age + 1)); } }
81. Elements Initialization Element Type Initial Value byte 0 int 0 float 0.0f char ‘ 0000’ object reference null short 0 long 0L double 0.0d boolean false
82.
83.
84. Arrays – Example // Finding the smallest and largest // elements in an array int[] values = {3,2,4,5,6,12,4,5,7}; int min = values[0]; int max = values[0]; for (int i=1; i<values.length; i++) { if (values[i] < min) { min = values[i]; } else if (values[i] > max) { max = values[i]; } } System.out.printf("MIN=%d", min); System.out.printf("MAX=%d", max);
85.
86.
87.
88.
89. M ulti-dimension al A rrays – Example // Finding the sum of all positive // cells from the matrix int[][] matrix = {{2,4,-3}, {8,-1,6}}; int sum = 0; for (int row=0; row<matrix.length; row++) { for (int col=0; col<matrix[row].length; col++) { if (matrix[row][col] > 0) { sum += matrix[row][col]; } } } System.out.println("Sum = " + sum);
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## The Java API is set of runtime libraries that give you a standard way to access the system resources of a host computer. When you write a Java program, you assume the class files of the Java API will be available at any Java virtual machine that may ever have the privilege of running your program (because the Java virtual machine and the class files for the Java API are the required components of any implementation of the Java Platform). When you run a Java program, the virtual machine loads the Java API class files that are referred to by your program's class files. The combination of all loaded class files (from your program and from the Java API) and any loaded dynamic libraries (containing native methods) constitute the full program executed by the Java virtual machine. The class files of the Java API are inherently specific to the host platform. To access the native resources of the host, the Java API calls native methods. The class files of the Java API invoke native methods so your Java program doesn't have to. In this manner, the Java API's class files provide a Java program with a standard, platform-independent interface to the underlying host. Creating platform- independent API is inherently difficult , given that system functionality varies greatly from one platform to another. In addition to facilitating platform independence, the Java API contributes to Java's security model. The methods of the Java API, before they perform any action that could potentially be harmful (such as writing to the local disk), check for permission. In Java releases prior to 1.2, the methods of the Java API checked permission by querying the security manager . The security manager is a special object that defines a custom security policy for the application . A security manager could, for example, forbid access to the local disk.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## As a whole, Java technology leans heavily in the direction of networks, but the Java programming language is quite general-purpose . 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. 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. 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. 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 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.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## The executables “javac” and “java” are platform-specific and are part of the Java Development Kit (JDK), which must be installed on the target host machine. Each of the executables take large number of arguments that customize the compilation and execution process (set custom classpath etc.)
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 To create an application, you write a class definition that includes a main() method. To execute an application, type java at the command line, followed by the name of the class containing the main() method to be executed. The main() method must be public so that the JVM can call it. It is static so that it can be executed without the necessity of constructing an instance of the application class. The return type must be void . The argument to main() is a single-dimension array of Strings, containing any arguments that the user might have entered on the command line. For example, consider the following command line: # java Mapper France Belgium With this command line, the args[] array has two elements: France in args[0], and Belgium in args[1].
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 Unused keywords There are two keywords that are reserved in Java but which are not used. If you try to use one of these reserved keywords, the Java compiler will produce the following: KeywordTest.java:4: ‘goto’ not supported. goto MyLabel; 1 error const Do not use to declare a constant; use public static final . goto Not implemented in the Java language.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 According to the Java Language Specification these are technically literal values and not keywords. A literal is much the same as a number or any other value. If we try to create an identifier with one of these literal values we will receive errors. class LiteralTest { public static void main (String [] args) { int true = 100; // this will cause error } } Compiling this code gives us the following error: c:Java ProjectsLiteralTest>javac LiteralTest.java LiteralTest.java:3: Invalid expression statement. int true = 100; .. In other words, trying to assign a value to true is much like saying: int 200 = 100;
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 All numeric primitive types are signed. The char type is integral but unsigned. The range of a variable of type char is from 0 through 216 − 1. Java characters are in Unicode, which is a 16-bit encoding capable of representing a wide range of international characters. If the most significant 9 bits of a char are all 0, then the encoding is the same as 7-bit ASCII.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 These types conform to the IEEE 754 specification. Many mathematical operations can yield results that have no expression in numbers (infinity, for example). To describe such non-numeric situations, both double and float can take on values that are bit patterns that do not represent numbers. Rather, these patterns represent non-numeric values. The patterns are defined in the Float and Double classes and may be referenced as shown in the next slide.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 NaN stands for Not a Number The following code fragment shows the use of these constants: double d = -10.0 / 0.0; if (d == Double.NEGATIVE_INFINITY) { System.out.println(&quot;d just exploded: &quot; + d); } In this code fragment, the test on line 2 passes, so line 3 is executed. Non-numeric values cannot be compared – the following is TRUE: ( Float.NaN != Float.NaN )
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 The Java operators are listed in precedence order, with the highest precedence at the top of the table. Each group has been given a name for reference purposes; that name is shown in the left column of the table. Arithmetic and comparison operators are each split further into two sub groupings because they have different levels of precedence. We’ll discuss these groupings later.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 These are applicable to all numeric types and to char and produce a boolean result.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 Notice that arithmetic promotions are applied when these operators are used. This is entirely according to the normal rules discussed in Module 4. For example, although it would be an error to attempt to assign, say, the float value 9.0F to the char variable c , it is perfectly acceptable to compare the two. To achieve the result, Java promotes the smaller type to the larger type; hence the char value ‘A’ (represented by the Unicode value 65) is promoted to a float 65.0F. The comparison is then performed on the resulting float values. Although the ordinal comparisons operate satisfactorily on dissimilar numeric types, including char , they are not applicable to any non-numeric types. They cannot take boolean or any classtype operands.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 If the cast, which is represented by the (int) part, were not present, the compiler would reject the assignment; a double value, such as is returned by the arithmetic here, cannot be represented accurately by an int variable. Casts can also be applied to object references. This often happens when you use containers, such as the Vector object. If you put, for example, String objects into a Vector, then when you extract them, the return type of the elementAt() method is simply Object. Module 4, “Converting and Casting,” covers casting, the rules governing which casts are legal and which are not, and the nature of the runtime checks that are performed on cast operations.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 An evaluation from left to right requires that the leftmost expression, a[b], be evaluated first, so it is a reference to the element a[1]. Next, b is evaluated, which is simply a reference to the variable called b. The constant expression 0 is evaluated next, which clearly does not involve any work. Now that the operands have been evaluated, the operations take place. This is done in the order specified by precedence and associativity. For assignments, associativity is right to left, so the value 0 is first assigned to the variable called b; then the value 0 is assigned into the last element of the array a.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 A Java array is an ordered collection of primitives, object references, or other arrays. Java arrays are homogeneous: except as allowed by polymorphism, all elements of an array must be of the same type. That is, when you create an array, you specify the element type, and the resulting array can contain only elements that are instances of that class or subclasses of that class.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 The first example declares an array of a primitive type. Example 2 declares an array of object references (Dimension is a class in the java.awt package). Example 3 declares a two-dimensional array—that is, an array of arrays of floats. The square brackets can come before or after the array variable name - This is also true, and perhaps most useful, in method declarations. A method that takes an array of doubles could be declared as myMethod(double dubs[]) or as myMethod(double[] dubs); a method that returns an array of doubles may be declared as either double[] anotherMethod() or as double anotherMethod()[]. In this last case, the first form is probably more readable.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 Since array size is not used until runtime, it is legal to specify size with a variable rather than a literal: int size = 1152 * 900; int [] raster; raster = new int[size];
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 Arrays are actually objects, even to the extent that you can execute methods on them (mostly the methods of the Object class), although you cannot subclass the array class. So this initialization is exactly the same as for other objects, and as a consequence you will see the initialization table again in the next section.
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 Of course, an array can also be initialized by explicitly assigning a value to each element, starting at array index 0: long [] squares; squares = new long[6000]; for ( int i = 0; i < squares.length; i++) { squares[i] = i * i; } Keep in mind, that the next code is also legal, although it will show only 3 elements: float [] diameters = {1.1f, 2.2f, 3.3f, }; for ( int i = 0; i < diameters.length; i++) { System.out.println(&quot;Element [&quot; + i + &quot;] = &quot; + diameters[i]); }
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 Actually, the f igure is misleading. myInts is actually an array with three elements. Each element is a reference to an array containing 4 ints, as shown in the next slide .
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 Actually, the f igure is misleading. myInts is actually an array with three elements. Each element is a reference to an array containing 4 ints, as shown in the next slide .
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ## ## (c) 2006 National Academy for Software Development - http://academy.devbg.org* * 07/16/96 When you realize that the outermost array is a single-dimension array containing references, you understand that you can replace any of the references with a reference to a different subordinate array, provided the new subordinate array is of the right type. For example, you can do the following: int [][] myInts = { {1, 2, 3}, {91, 92, 93, 94}, {2001, 2002} }; int [] replacement = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; myInts[1] = replacement;
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 07/16/96 (c) 2006 National Academy for Software Development - http://academy.devbg.org* ##
* 10/09/1007/16/96 (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
* 10/09/1007/16/96 (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
* 10/09/1007/16/96 (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
* 10/09/1007/16/96 (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
* 10/09/1007/16/96 (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
* 10/09/1007/16/96 (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
* 10/09/1007/16/96 (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##
* 10/09/1007/16/96 (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* ##