This document provides an introduction to Java programming through a series of Java 101 tutorials. It discusses setting up a Java development environment, provides an overview of the Java language, and demonstrates how to write a first Java program. It also covers built-in Java data types like String, int, double, and boolean, and control structures like conditionals and loops. The document concludes with exercises for readers to practice working with command line arguments, operators, arrays, and random number generation in Java.
Rule 1: Follow a consistent coding standard
Rule 2: Name things properly, long variable and function names are allowed
Rule 3: Be expressive, write code as you speak and be optimally verbose
Rule 4: Max indent per method should be 2, in case of exceptions 3
Rule 5: Avoid creating god object and long methods
Rule 6: Keep the method in one place, inject the class and call it, DRY
Rule 7: Avoid in-line comments (comment with code), put comments in the method doc
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.
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.
Rule 1: Follow a consistent coding standard
Rule 2: Name things properly, long variable and function names are allowed
Rule 3: Be expressive, write code as you speak and be optimally verbose
Rule 4: Max indent per method should be 2, in case of exceptions 3
Rule 5: Avoid creating god object and long methods
Rule 6: Keep the method in one place, inject the class and call it, DRY
Rule 7: Avoid in-line comments (comment with code), put comments in the method doc
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.
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 Strings Tutorial | String Manipulation in Java | Java Tutorial For Begin...Edureka!
**** Java Certification Training: https://www.edureka.co/java-j2ee-soa-training ****
This Edureka tutorial on “Java Strings” will talk about one of the most important classes of Java i.e String class. It will also talk about the various methods and interfaces implemented by the String class. Through this tutorial you will learn the following topics:
Java Strings
String Pool
Creating a String
String Methods
Check out our Java Tutorial blog series: https://goo.gl/osrGrS
Check out our complete Youtube playlist here: https://goo.gl/gMFLx3
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...Edureka!
This Edureka 'Java Classes' tutorial will take you through in-depth details of Java classes and different key-components in Java. It is ideal for both beginners and professionals who want to learn or brush up the basics of Java. Below are the topics covered in this tutorial:
1. Classes in Java
2. Constructors
3. Structure of a Class
4. Overview of Objects
5. Working with Objects
6. Multiple classes
7. OOPS concepts: Inheritance, Encapsulation, Abstraction, Interface
Java Strings Tutorial | String Manipulation in Java | Java Tutorial For Begin...Edureka!
**** Java Certification Training: https://www.edureka.co/java-j2ee-soa-training ****
This Edureka tutorial on “Java Strings” will talk about one of the most important classes of Java i.e String class. It will also talk about the various methods and interfaces implemented by the String class. Through this tutorial you will learn the following topics:
Java Strings
String Pool
Creating a String
String Methods
Check out our Java Tutorial blog series: https://goo.gl/osrGrS
Check out our complete Youtube playlist here: https://goo.gl/gMFLx3
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Java Classes | Java Tutorial for Beginners | Java Classes and Objects | Java ...Edureka!
This Edureka 'Java Classes' tutorial will take you through in-depth details of Java classes and different key-components in Java. It is ideal for both beginners and professionals who want to learn or brush up the basics of Java. Below are the topics covered in this tutorial:
1. Classes in Java
2. Constructors
3. Structure of a Class
4. Overview of Objects
5. Working with Objects
6. Multiple classes
7. OOPS concepts: Inheritance, Encapsulation, Abstraction, Interface
Core Java introduction | Basics | free course Kernel Training
http://kerneltraining.com/core-java/
Learn the basics of Java and gain practical experience that is required to begin your career in java programming. Kernel Training has designed classroom and online course to upgrade your knowledge and skills in core Java.
Course Curriculum:
Introduction to Java
JDK and practical applications
Java Basic Data Types and Operators
Programming Constructs, Classes and Methods, constructor and Finalizer
Polymorphism
Inheritance
Method overriding and abstract classes
Packages and Interfaces
Strings and Arrays
Enums
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
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.
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
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.
top nidhi software solution freedownloadvrstrong314
This presentation emphasizes the importance of data security and legal compliance for Nidhi companies in India. It highlights how online Nidhi software solutions, like Vector Nidhi Software, offer advanced features tailored to these needs. Key aspects include encryption, access controls, and audit trails to ensure data security. The software complies with regulatory guidelines from the MCA and RBI and adheres to Nidhi Rules, 2014. With customizable, user-friendly interfaces and real-time features, these Nidhi software solutions enhance efficiency, support growth, and provide exceptional member services. The presentation concludes with contact information for further inquiries.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
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.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
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/
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).
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
2. Introduction
• Your Name: Manuela Grindei
• Your day job: Software Developer @ Gamesys
• Your last holiday destination: Dublin
3. Java 101
• Java Fundamentals
– Setting up your development environment
– Language Overview
– How Java Works
– Writing your first program
– Built-in Data Types
– Conditionals and Loops
4. Java 102
• Object-oriented Programming
– Classes and Objects
– Polymorphism, Inheritance and Encapsulation
– Functions and Libraries
7. Installing Java Development Kit
• Download latest Java SE 8 JDK (not JRE) from
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-
downloads-2133151.html
• For Windows,
– download the X86 version, double click the .exe file and follow the
instructions, accepting all default
• For MACs,
– check if java already installed (javac –version) and if not, download the
JDK dmg file, run it and follow the instructions.
• After installation is complete, type javac –version in the Command
window (Terminal window on MAC OS)-
– The reported version should be 1.8....
– If not, you may need to modify the system variable PATH to include the
bin directory of JDK
8. What is an IDE?
• IDE = Integrated Development Environment
• Makes you more productive
• Includes text editor, compiler, debugger,
context- sensitive help, works with different
Java SDKs
• Eclipse is the most widely used IDE
• Alternatives:
– IntelliJ IDEA (JetBrains)
– NetBeans (Oracle)
9. Installing Eclipse
• Download and install the latest Eclipse for Java
EE (32 Bit version) from
http://www.eclipse.org/downloads
• Unzip the content of the archive file you
downloaded
• To start Eclipse
– On PC, double-click on Eclipse.exe
– On Mac, double click Eclipse.app in Application
folder
14. Java Editions
• Java SE: Java Standard Edition
• Java EE: Java Enterprise Edition (a.k.a. J2EE)
– includes a set of technologies built on top of Java
SE: Servlets, JSP, JSF, EJB, JMS, et al.
• Java ME: Java Micro Edition
• Java Card for Smart Cards
• All Java programs run inside the Java Virtual
Machine (JVM)
15. JDK vs. JRE
• Java Development Kit (JDK) is required to
develop and compile programs
• Java Runtime Environment (JRE) is required to
run programs
• Users must have JRE installed
• Developers must have the JDK installed
• JDK includes the JRE
20. Writing Your First Java Program
• Create a new project in your IDE named Java101
• Create a HelloWorld class in the src folder inside the Java101
project as illustrated below.
21. Anatomy of a Java Application
Comments Class Name
Access
modifier
Function/static
method
Arguments
22. Compiling Your First Java Program
• Save the HelloWorld class in the IDE
• Run your program: right-clicking and selecting Run
As>Java Application
• This automatically compiles the HelloWorld.java file into
into a HelloWorld.class file
• Go to the folder you created the Java101 project on your
hard disk and open the src(eclipse) or out (Intelli j)folder.
• What do you see?
25. Built-in Data Types
• Data types are sets of values and operations
defined on those values
26. Basic Definitions
• Variable - a name that refers to a value.
• Assignment statement - associates a value
with a variable.
27. String Data Type
Data Type Attributes
Values sequence of characters
Typical literals “Hello”, “1 “, “*”
Operation Concatenate
Operator +
• Useful for program input and output.
32. Exercise: Command Line Arguments
• Create the Java program below that takes a name as
command-line argument and prints “Hi <name>,
How are you?”
33. Integer Data Type
Data Type Attributes
Values Integers between -2^31 to +2^31-1
Typical literals 1234, -99 , 99, 0, 1000000
Operation Add subtract multiply divide remainder
Operator + - * / %
• Useful for expressing algorithms.
34. Integer Data Type
Expression Value Comment
5 + 3 8
5 – 3 2
5 * 3 15
5 / 3 1 no fractional part
5 % 3 2 remainder
1 / 0 run-time error
3 * 5 - 2 13 * has precedence
3 + 5 / 2 5 / has precedence
3 – 5 - 2 -4 left associative
(3-5) - 2 -4 better style
3 – (5-2) 0 unambiguous
35. Double Data Type
• Useful in scientific applications and floating-
point arithmetic
Data Type Attributes
Values Real numbers specified by the IEEE 754 standard
Typical literals 3.14159 6.022e23 -3.0 2.0 1.41421356237209
Operation Add subtract multiply divide
Operator + - * /
39. Exercise: Integer Operations
• Create a Java class named IntOps in the Java101
project that performs integer operations on a pair of
integers from the command line and prints the results.
41. Boolean Data Type
• Useful to control logic and flow of a program.
Data Type Attributes
Values true or false
Typical literals true false
Operation and or not
Operator && || !
43. Logical operators
• & (AND): Only TRUE if both operands are TRUE
• | (OR): Only FALSE if both operands are FALSE
• ^ (EXCLUSIVE OR): Only TRUE if both operands are
DIFFERENT
44. Conditional & Negation operators
a !a a b a && b a || b
True False False False False False
False True False True False True
True false False True
True True true True
45. Boolean Comparisons
• Take operands of one type and produce an
operand of type boolean.
operation meaning true false
== equals 2 == 2 2 == 3
!= Not equals 3 != 2 2 != 2
< Less than 2 < 13 2 < 2
<= Less than or equal 2 <= 2 3 <= 2
> Greater than 13 > 2 2 > 13
>= Greater than or
equal
3 >= 2 2 >= 3
46. Type Conversion
• Convert from one type of data to another.
• Implicit
– no loss of precision
– with strings
• Explicit:
– cast
– method.
47. Type Conversion Examples
expression Expression type Expression value
“1234” + 99 String “123499”
Integer.parseInt(“123”) int 123
(int) 2.71828 int 2
Math.round(2.71828) long 3
(int) Math.round(2.71828) int 3
(int) Math.round(3.14159) int 3
11 * 0.3 double 3.3
(int) 11 * 0.3 double 3.3
11 * (int) 0.3 int 0
(int) (11 * 0.3) int 3
49. Exercise: Leap Year Finder
• A year is a leap year if it is either divisible by 400
or divisible by 4 but not 100.
• Write a java class named LeapYear in the Java101
project that takes a numeric year as command
line argument and prints true if it’s a leap year
and false if not
51. Data Types Summary
• A data type is a set of values and operations on those
values.
– String for text processing
– double, int for mathematical calculation
– boolean for decision making
• In Java, you must:
– Declare type of values.
– Convert between types when necessary
• Why do we need types?
– Type conversion must be done at some level.
– Compiler can help do it correctly.
– Example: in 1996, Ariane 5 rocket exploded after takeoff
because of bad type conversion.
53. Conditionals and Loops
• Sequence of statements that are actually
executed in a program.
• Enable us to choreograph control flow.
54. Conditionals
• The if statement is a common branching structure.
– Evaluate a boolean expression.
• If true, execute some statements.
• If false, execute other statements.
57. While Loop
• A common repetition structure.
– Evaluate a boolean expression.
– If true, execute some statements.
– Repeat.
58. For Loop
• Another common repetition structure.
– Execute initialization statement.
– Evaluate a boolean expression.
• If true, execute some statements.
– And then the increment statement.
– Repeat.
63. Exercise: Powers of Two
• Create a new Java project in Eclipse named Pow2
• Write a java class named PowerOfTwo to print powers of 2 that are
<= 2N where N is a number passed as an argument to the program.
– Increment i from 0 to N.
– Double v each time
65. Control Flow Summary
• Sequence of statements that are actually
executed in a program.
• Conditionals and loops enable us to choreograph
the control flow.
Control flow Description Example
Straight line
programs
all statements are executed in the
order given
Conditionals certain statements are executed
depending on the values of certain
variables
If
If-else
Loops certain statements are executed
repeatedly until certain conditions
are met
while
for
do-while
68. Exercise: Random Number Generator
• Write a java class named RandomInt to generate a
pseudo-random number between 0 and N-1 where N is
a number passed as an argument to the program
71. Exercise: Array of Days
• Create a java class named DayPrinter that
prints out names of the days in a week from an
array using a for-loop.
72. Solution: Arrays of Days
public class DayPrinter {
public static void main(String[] args) {
//initialize the array with the names of days of the
week
String[] daysOfTheWeek =
{"Sunday","Monday","Tuesday","Wednesday",
"Thuesday","Friday”,"Saturday"};
//loop through the array and print their elements to
//stdout
for (int i= 0;i < daysOfTheWeek.length;i++ ){
System.out.println(daysOfTheWeek[i]);
}
}
}
% javac DayPrinter.java
% java DayPrinter
Sunday
Monday
Tuesday
Wednesday
Thuesday
Friday
Saturday
74. Exercise: Print Personal Details
• Write a program that will print your name and
address to the console, for example:
Alex Johnson
23 Main Street
New York, NY 10001 USA
76. Exercise: Sales Discount
• Create a new project in Eclipse named Sale
• Create, compile, and run the FriendsAndFamily class as illustrated below
• Debug this program in your IDE to find out how it works
77. Further Reading
• Java Tutorials - https://docs.oracle.com/javase/tutorial/
• Java Language Basics -
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/index.html
• Eclipse IDE Workbench User Guide -
http://help.eclipse.org/kepler/index.jsp
• Intelli J IDE User Guide - https://www.jetbrains.com/idea/documentation/
• Eclipse Tutorial - http://www.vogella.com/tutorials/Eclipse/article.html
Editor's Notes
System is a final class from java.lang package.out is the reference of PrintStream class and a static member of System class.println is a method of PrintStream class.
System is a built-in class...
System is a final class from java.lang package.out is the reference of PrintStream class and a static member of System class.println is a method of PrintStream class.
Variables hold the state of the program, and methods operate on that state. If the change is important to remember, a variable stores that change. That’s all classes really do.
Java calls a word with special meaning a keyword
It probably comes as no surprise that Java has precise rules about identifier names. Luckily, the same rules for identifiers apply to anything you are free to name, including variables, methods, classes, and fields.
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. As you might imagine, a reserved word is a keyword that Java has reserved so that you are not allowed to use it. Remember that Java is case sensitive, so you can use versions of the keywords that only differ in case. Please don’t, though.
The Integer class wraps a value of the primitive type int in an object. An object of type Integer contains a single field whose type is int.In addition, this class provides several methods for converting an int to a String and a String to an int, as well as other constants and methods useful when dealing with an int.
The last thing you need to know about numeric literals is a feature added in Java 7. You can have underscores in numbers to make them easier to read:
Literals are valid values assigned to data types
To sum up:
- float is represented in 32 bits, with 1 sign bit, 8 bits of exponent, and 23 bits of the mantissa (or what follows from a scientific-notation number: 2.33728*1012; 33728 is the mantissa).
- Double is represented in 64 bits, with 1 sign bit, 11 bits of exponent, and 52 bits of mantissa.
By default, Java uses double to represent its floating-point numerals (so a literal 3.14 is typed double). It's also the data type that will give you a much larger number range, so I would strongly encourage its use over float.
There may be certain libraries that actually force your usage of float, but in general - unless you can guarantee that your result will be small enough to fit in float's prescribed range, then it's best to opt with double.
& (AND): Only TRUE if both operands are TRUE
| (OR): Only FALSE if both operands are FALSE
^ (EXCLUSIVE OR): Only TRUE if both operands are DIFFERENT