This document provides an introduction to basic Java programming concepts including variables, data types, identifiers, keywords, comments, and outputting variable values. It discusses the different primitive data types in Java like int, double, char, etc. and how to declare and initialize variables of these types. The document also covers Java naming conventions for classes, methods and variables. It explains how to write single line, multi-line and javadoc comments. Finally, it demonstrates how to use System.out.println() and System.out.print() to output the values of variables.
This keyword is a reference variable that refer the current object in java.
This keyword can be used for call current class constructor.
http://www.tutorial4us.com/java/java-this-keyword
Java has two types of data types - primitive and non-primitive. Primitive types include integer, character, boolean, and floating point types like float and double which are used to represent numbers with decimals. Non-primitive types include classes, interfaces, and arrays. A variable in Java is a memory location that can store a value, and there are different types of variables including instance variables, class variables, local variables, and parameters. Variables are declared with a data type and name, and can be initialized with a value.
This document discusses connecting Python to a MySQL database. It introduces database programming in Python and the Python DB API interface. It then provides 7 steps to connect to a MySQL database using the MySQL Connector Python package, including importing the package, opening a connection, creating a cursor, executing queries, extracting the result set, and closing the connection.
This document provides an overview of Java applets, including:
- Applets are small Java programs that can be transported over the network and embedded in HTML pages.
- The main types of Java programs are standalone programs and web-based programs like applets.
- Applets differ from applications in that they have a predefined lifecycle and are embedded in web pages rather than running independently.
- The Applet class is the superclass for all applets and defines methods corresponding to the applet lifecycle stages like init(), start(), paint(), stop(), and destroy().
- Common methods for applets include drawString() for output, setBackground()/getBackground() for colors, and showStatus() to display in
This presentation introduces Java Applet and Java Graphics in detail with examples and finally using the concept of both applet and graphics code the analog clock project to depict how to use them in real life challenges and applications.
The document discusses the structure of a Java program. A Java program contains classes, with one class containing a main method that acts as the starting point. Classes contain data members and methods that operate on the data. Methods contain declarations and executable statements. The structure also includes sections for documentation, package statements, import statements, interface statements, and class definitions, with the main method class being essential.
The document provides an overview of web development. It discusses what a website is and how it is hosted. It then defines web development as the process of developing websites for the internet or intranets, ranging from simple static pages to complex web applications. The document outlines the main tasks involved in web development like design, content development, scripting, and security configuration. It also discusses some key aspects to consider before developing a website such as content, hosting, interactivity, and cross-browser compatibility.
This keyword is a reference variable that refer the current object in java.
This keyword can be used for call current class constructor.
http://www.tutorial4us.com/java/java-this-keyword
Java has two types of data types - primitive and non-primitive. Primitive types include integer, character, boolean, and floating point types like float and double which are used to represent numbers with decimals. Non-primitive types include classes, interfaces, and arrays. A variable in Java is a memory location that can store a value, and there are different types of variables including instance variables, class variables, local variables, and parameters. Variables are declared with a data type and name, and can be initialized with a value.
This document discusses connecting Python to a MySQL database. It introduces database programming in Python and the Python DB API interface. It then provides 7 steps to connect to a MySQL database using the MySQL Connector Python package, including importing the package, opening a connection, creating a cursor, executing queries, extracting the result set, and closing the connection.
This document provides an overview of Java applets, including:
- Applets are small Java programs that can be transported over the network and embedded in HTML pages.
- The main types of Java programs are standalone programs and web-based programs like applets.
- Applets differ from applications in that they have a predefined lifecycle and are embedded in web pages rather than running independently.
- The Applet class is the superclass for all applets and defines methods corresponding to the applet lifecycle stages like init(), start(), paint(), stop(), and destroy().
- Common methods for applets include drawString() for output, setBackground()/getBackground() for colors, and showStatus() to display in
This presentation introduces Java Applet and Java Graphics in detail with examples and finally using the concept of both applet and graphics code the analog clock project to depict how to use them in real life challenges and applications.
The document discusses the structure of a Java program. A Java program contains classes, with one class containing a main method that acts as the starting point. Classes contain data members and methods that operate on the data. Methods contain declarations and executable statements. The structure also includes sections for documentation, package statements, import statements, interface statements, and class definitions, with the main method class being essential.
The document provides an overview of web development. It discusses what a website is and how it is hosted. It then defines web development as the process of developing websites for the internet or intranets, ranging from simple static pages to complex web applications. The document outlines the main tasks involved in web development like design, content development, scripting, and security configuration. It also discusses some key aspects to consider before developing a website such as content, hosting, interactivity, and cross-browser compatibility.
1) Comparable and Comparator interfaces in Java can both be used to sort collections but have some key differences. Comparable provides a single sort order while Comparator allows multiple sort orders.
2) WritableComparable is a subinterface that extends both Writable and Comparable interfaces. Any type used as a key in Hadoop MapReduce must implement this interface.
3) RawComparator is an optimization Hadoop provides to directly compare byte arrays containing serialized objects instead of deserializing for comparison. WritableComparator implements RawComparator for WritableComparable types.
The document provides an overview of Java applets, including:
1. An applet is a Java program that can be embedded in an HTML page and runs in web browsers.
2. Advantages of applets include being cross-platform, supported by most browsers, and cached for faster loading.
3. Disadvantages include requiring the Java plugin and JVM, and being slower to load than HTML.
The document introduces the Dart programming language. Dart is an open-source language developed by Google to be a better JavaScript for building web applications. It is compiled to JavaScript and can be used to build client, server, and mobile applications. The document provides an overview of Dart's features such as being object-oriented, optional typing, compiling to JavaScript, and libraries. It also describes tools for developing in Dart like the Dart SDK, Dartium browser, and pub package manager.
This document discusses ADO.NET, which is a set of classes that allows .NET applications to communicate with databases. It provides advantages over classic ADO such as supporting both connected and disconnected data access. The key components of ADO.NET are data providers, which act as bridges between applications and databases, and the DataSet, which allows storing and manipulating relational data in memory disconnected from the database.
Facing interviews is both science and an art. Typically for freshers, it becomes very challenging to face interviews. Here is a presentation that gives you practical tips and inputs to crack interviews.
Java is a general-purpose computer-programming language that is concurrent, class-based, object-oriented,[15] and specifically designed to have as few implementation dependencies as possible
Basic java important interview questions and answers to secure a jobGaruda Trainings
P2Cinfotech is one of the leading, Online IT Training facilities and Job Consultant, spread all over the world. We have successfully conducted online classes on various Software Technologies that are currently in Demand. To name a few, we provide quality online training for QA, QTP, Manual Testing, HP LoadRunner, BA, Java Technologies, SEO, Web Technologies, .NET, Oracle DBA etc.
This document provides an overview of Flask, a microframework for Python. It discusses that Flask is easy to code and configure, extensible via extensions, and uses Jinja2 templating and SQLAlchemy ORM. It then provides a step-by-step guide to setting up a Flask application, including creating a virtualenv, basic routing, models, forms, templates, and views. Configuration and running the application are also covered at a high level.
Java is a compiled and interpreted, platform-independent, secure, robust, and object-oriented programming language. It is compiled into bytecode that can run on any Java Virtual Machine (JVM), making programs portable across platforms. The JVM is available on many operating systems, so Java code can run on Windows, Linux, Solaris, or Mac OS. Java uses automatic memory management, exceptions, and avoids many common programming bugs found in other languages like C/C++.
An interface in Java is a blueprint of a class that defines static constants and abstract methods. Interfaces are implemented by classes where they inherit the properties and must define the body of the abstract methods. Key points are:
- Interfaces can only contain abstract methods and static constants, not method bodies.
- Classes implement interfaces to inherit the properties and must define the abstract method bodies.
- An interface can extend other interfaces and a class can implement multiple interfaces.
This presentation introduces Java packages, including system packages that are part of the Java API and user-defined packages. It discusses how packages organize related classes and interfaces, the structure of package names and directories, and how to create and access packages. Packages provide advantages like grouping related code, preventing name collisions, and improving reusability.
Cascading Style Sheets (CSS) allow developers and users more control over how web pages are displayed. CSS style sheets define the appearance of different HTML elements like headers and links. Multiple style sheets can be applied to a web page. CSS provides benefits like consistent appearance across pages, easier maintenance, and increased accessibility.
This document provides an overview of different PHP data types including strings, integers, floats, booleans, arrays, objects, NULL, and resources. It describes each data type, provides examples, and explains what each can store and how they are different. The document also introduces some common PHP string functions like strlen(), str_word_count(), strrev(), strpos(), and str_replace() and provides brief descriptions of what each function does.
This document provides an overview of the Java programming language. It discusses what Java is, its platform independence, common applications, and key features such as being simple, object-oriented, robust, secure, portable, and high-performance. The document also covers Java variables, data types, operators, control statements, classes and objects, constructors, and static keywords. It provides examples of a first Java program and differences between JDK, JRE, and JVM.
Multithreading allows programs to have multiple threads that can run concurrently. Each thread defines a separate path of execution. Processes are programs that are executing, while threads exist within a process and share its resources. Creating a new thread requires fewer resources than creating a new process. There are two main ways to define a thread - by implementing the Runnable interface or by extending the Thread class.
Java is an object-oriented programming language initially developed by Sun Microsystems. It was released in 1995. Key points:
- Java can be used to develop client-side standalone applications, applets for webpages, and server-side applications.
- It introduced the Java Virtual Machine (JVM) which allows Java programs to run on any platform that supports the JVM.
- Java's use of bytecode makes it portable and able to run on any device with a JVM, earning it the label of "Write Once, Run Anywhere".
Constructor is a special member method which will be called automatically when you create an object of any class.
The main purpose of using constructor is to initialize an object.
http://www.tutorial4us.com/java/java-constructor
The document provides an overview of the Python programming language. It discusses that Python is an easy to learn, high-level, open-source programming language. It describes Python's design philosophy of code readability and how it allows programmers to express concepts in fewer lines of code compared to languages like C++ and Java. The document also discusses Python's powerful libraries, wide use across industries, and how to get started with Python programming using the IDLE integrated development environment.
This presentation provides an overview of the Java programming language. It discusses what Java is, where it is used, its features, how Java programs are translated and run on the Java Virtual Machine. It also covers Java concepts like object-oriented programming, data types in Java, garbage collection, and the development phases of a Java program. Finally, it proposes a project idea of developing an intranet mailing system and concludes by thanking the audience and asking if there are any questions.
This document provides an overview of key concepts in Java programming including:
1) The components of a Java program such as statements, blocks, classes, and methods.
2) How to structure Java source code files with classes and the main method.
3) Common elements in Java programs like variables, data types, operators, and comments.
4) Details on specific concepts like declaring and initializing variables, arithmetic operators, and increment/decrement operators.
This document discusses naming conventions and data types in Java. It provides guidelines for naming classes, methods, variables and packages using camel case and other conventions. It also describes the different primitive and non-primitive data types in Java like integer, floating point, character, boolean, and object reference types. Local, instance, and static variables are explained. The document also covers the different types of literals in Java including integer, floating point, character, string, and boolean literals.
1) Comparable and Comparator interfaces in Java can both be used to sort collections but have some key differences. Comparable provides a single sort order while Comparator allows multiple sort orders.
2) WritableComparable is a subinterface that extends both Writable and Comparable interfaces. Any type used as a key in Hadoop MapReduce must implement this interface.
3) RawComparator is an optimization Hadoop provides to directly compare byte arrays containing serialized objects instead of deserializing for comparison. WritableComparator implements RawComparator for WritableComparable types.
The document provides an overview of Java applets, including:
1. An applet is a Java program that can be embedded in an HTML page and runs in web browsers.
2. Advantages of applets include being cross-platform, supported by most browsers, and cached for faster loading.
3. Disadvantages include requiring the Java plugin and JVM, and being slower to load than HTML.
The document introduces the Dart programming language. Dart is an open-source language developed by Google to be a better JavaScript for building web applications. It is compiled to JavaScript and can be used to build client, server, and mobile applications. The document provides an overview of Dart's features such as being object-oriented, optional typing, compiling to JavaScript, and libraries. It also describes tools for developing in Dart like the Dart SDK, Dartium browser, and pub package manager.
This document discusses ADO.NET, which is a set of classes that allows .NET applications to communicate with databases. It provides advantages over classic ADO such as supporting both connected and disconnected data access. The key components of ADO.NET are data providers, which act as bridges between applications and databases, and the DataSet, which allows storing and manipulating relational data in memory disconnected from the database.
Facing interviews is both science and an art. Typically for freshers, it becomes very challenging to face interviews. Here is a presentation that gives you practical tips and inputs to crack interviews.
Java is a general-purpose computer-programming language that is concurrent, class-based, object-oriented,[15] and specifically designed to have as few implementation dependencies as possible
Basic java important interview questions and answers to secure a jobGaruda Trainings
P2Cinfotech is one of the leading, Online IT Training facilities and Job Consultant, spread all over the world. We have successfully conducted online classes on various Software Technologies that are currently in Demand. To name a few, we provide quality online training for QA, QTP, Manual Testing, HP LoadRunner, BA, Java Technologies, SEO, Web Technologies, .NET, Oracle DBA etc.
This document provides an overview of Flask, a microframework for Python. It discusses that Flask is easy to code and configure, extensible via extensions, and uses Jinja2 templating and SQLAlchemy ORM. It then provides a step-by-step guide to setting up a Flask application, including creating a virtualenv, basic routing, models, forms, templates, and views. Configuration and running the application are also covered at a high level.
Java is a compiled and interpreted, platform-independent, secure, robust, and object-oriented programming language. It is compiled into bytecode that can run on any Java Virtual Machine (JVM), making programs portable across platforms. The JVM is available on many operating systems, so Java code can run on Windows, Linux, Solaris, or Mac OS. Java uses automatic memory management, exceptions, and avoids many common programming bugs found in other languages like C/C++.
An interface in Java is a blueprint of a class that defines static constants and abstract methods. Interfaces are implemented by classes where they inherit the properties and must define the body of the abstract methods. Key points are:
- Interfaces can only contain abstract methods and static constants, not method bodies.
- Classes implement interfaces to inherit the properties and must define the abstract method bodies.
- An interface can extend other interfaces and a class can implement multiple interfaces.
This presentation introduces Java packages, including system packages that are part of the Java API and user-defined packages. It discusses how packages organize related classes and interfaces, the structure of package names and directories, and how to create and access packages. Packages provide advantages like grouping related code, preventing name collisions, and improving reusability.
Cascading Style Sheets (CSS) allow developers and users more control over how web pages are displayed. CSS style sheets define the appearance of different HTML elements like headers and links. Multiple style sheets can be applied to a web page. CSS provides benefits like consistent appearance across pages, easier maintenance, and increased accessibility.
This document provides an overview of different PHP data types including strings, integers, floats, booleans, arrays, objects, NULL, and resources. It describes each data type, provides examples, and explains what each can store and how they are different. The document also introduces some common PHP string functions like strlen(), str_word_count(), strrev(), strpos(), and str_replace() and provides brief descriptions of what each function does.
This document provides an overview of the Java programming language. It discusses what Java is, its platform independence, common applications, and key features such as being simple, object-oriented, robust, secure, portable, and high-performance. The document also covers Java variables, data types, operators, control statements, classes and objects, constructors, and static keywords. It provides examples of a first Java program and differences between JDK, JRE, and JVM.
Multithreading allows programs to have multiple threads that can run concurrently. Each thread defines a separate path of execution. Processes are programs that are executing, while threads exist within a process and share its resources. Creating a new thread requires fewer resources than creating a new process. There are two main ways to define a thread - by implementing the Runnable interface or by extending the Thread class.
Java is an object-oriented programming language initially developed by Sun Microsystems. It was released in 1995. Key points:
- Java can be used to develop client-side standalone applications, applets for webpages, and server-side applications.
- It introduced the Java Virtual Machine (JVM) which allows Java programs to run on any platform that supports the JVM.
- Java's use of bytecode makes it portable and able to run on any device with a JVM, earning it the label of "Write Once, Run Anywhere".
Constructor is a special member method which will be called automatically when you create an object of any class.
The main purpose of using constructor is to initialize an object.
http://www.tutorial4us.com/java/java-constructor
The document provides an overview of the Python programming language. It discusses that Python is an easy to learn, high-level, open-source programming language. It describes Python's design philosophy of code readability and how it allows programmers to express concepts in fewer lines of code compared to languages like C++ and Java. The document also discusses Python's powerful libraries, wide use across industries, and how to get started with Python programming using the IDLE integrated development environment.
This presentation provides an overview of the Java programming language. It discusses what Java is, where it is used, its features, how Java programs are translated and run on the Java Virtual Machine. It also covers Java concepts like object-oriented programming, data types in Java, garbage collection, and the development phases of a Java program. Finally, it proposes a project idea of developing an intranet mailing system and concludes by thanking the audience and asking if there are any questions.
This document provides an overview of key concepts in Java programming including:
1) The components of a Java program such as statements, blocks, classes, and methods.
2) How to structure Java source code files with classes and the main method.
3) Common elements in Java programs like variables, data types, operators, and comments.
4) Details on specific concepts like declaring and initializing variables, arithmetic operators, and increment/decrement operators.
This document discusses naming conventions and data types in Java. It provides guidelines for naming classes, methods, variables and packages using camel case and other conventions. It also describes the different primitive and non-primitive data types in Java like integer, floating point, character, boolean, and object reference types. Local, instance, and static variables are explained. The document also covers the different types of literals in Java including integer, floating point, character, string, and boolean literals.
The document discusses various Java programming concepts including comments, identifiers, keywords, primitive data types, variables, objects, and access modifiers. It provides examples and definitions for each concept. The key points covered are the eight primitive data types in Java (boolean, char, byte, short, int, long, float, double), how to declare and initialize variables, how to construct objects using the new keyword, and the differences between public, private, protected, default, final, and abstract access modifiers.
The document provides an overview of Java concepts including:
1. The structure of a basic Java program including the class, main method, and print statement.
2. Explanations of keywords like public, static, void and how the main method works.
3. A description of Java APIs and how prewritten classes and packages are used.
4. Details on Java identifiers, variables, primitive and reference data types.
This document discusses Java variables, data types, and operators. It covers the basics of declaring variables in Java, including primitive and non-primitive data types. It also describes different types of variables, literals, casting, and operators such as arithmetic, assignment, comparison, and logical operators. Examples are provided to demonstrate variable declaration and usage of various operators.
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.
This document provides an introduction to Java. It discusses the history of Java, noting it was developed by James Gosling at Sun Microsystems in 1991. It states that Java resides on many platforms like mobile devices, desktops, servers, embedded devices, and the cloud. The key principle of Java is "write once, run anywhere." It also discusses Java libraries, versions of Java, features of Java like being object-oriented and portable, and how to install and set up Java. It provides an example of a simple "Hello World" Java program. It also covers Java data types, variables, typecasting, arrays, comments, and the Scanner class.
Full CSE 310 Unit 1 PPT.pptx for java languagessuser2963071
This document discusses Java programming fundamentals including naming conventions, data types, literals, and writing a basic Java program. It covers lowercase and uppercase naming rules for variables, methods, and classes. It also describes numeric, boolean, character, and string literals. Key data types like int, float, char, and their ranges are explained. The document provides examples of type conversion, casting, and type promotion in expressions. It concludes with steps for compiling and running a Java program.
The document discusses the basic data types in Java. It describes the 8 primitive data types - byte, short, int, long, float, double, boolean and char. It explains the minimum and maximum ranges for each data type and provides examples. It also discusses reference data types and the Java Scanner class for reading input from the keyboard.
This document summarizes key concepts from Chapter 2 of a Computer Programming I course, including:
- The structure of a Java program and how to save, compile, and run Java files.
- Using variables to store and represent data in Java, including data types, naming conventions, and assignment statements.
- How to select the proper data types for numerical variables and initialize variables.
- Using simple keyboard input and screen output in Java programs.
The document discusses the different primitive and reference data types in Java, including their sizes, value ranges, and default values. It explains that variables are reserved memory locations used to store values and that reference variables are used to access objects of a specific class. The key Java primitive data types are byte, short, int, long, float, double, boolean, and char, each with their own characteristics for storing integer, floating point, boolean, or character values.
The document provides an introduction to the Java programming language. It discusses what computer programs and programming languages are, and how Java programs are compiled into bytecode that can run on any machine with a Java interpreter. It then covers basic Java concepts like variables, primitive data types, operators, and object-oriented programming principles. The document includes examples of writing a simple Java program to output "Hello World" and explanations of core Java topics to help new programmers learn the language.
OCA Java SE 8 Exam Chapter 1 Java Building Blocksİbrahim Kürce
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.
Introduction to Java Object Oiented Concepts and Basic terminologiesTabassumMaktum
The document discusses the basic concepts of object-oriented programming including objects, classes, abstraction, encapsulation, inheritance, and polymorphism. It defines objects as entities with attributes and behaviors. Classes are templates that describe common properties and behaviors of objects. Abstraction hides unnecessary details and focuses on important attributes. Encapsulation binds code and data together and restricts access. Inheritance creates a parent-child relationship between classes where subclasses inherit attributes of base classes. Polymorphism allows the same operation to be applied to different types.
The document discusses key concepts in C# programming including variables, data types, flow control, enums, namespaces, the Main method, console I/O, preprocessor directives, and programming guidelines. It provides syntax examples for declaring variables, initializing variables, constants, conditional and loop statements, and namespaces. It also describes the Console class, XML documentation comments, and preprocessor directives.
This document provides an overview of key concepts in C# programming including variables, data types, comments, keywords, identifiers, expressions, statements, and blocks. It defines variables as containers that hold values and notes they have a name and data type. The document outlines the different data types in C# including fundamental types like int, char, and float, and derived types like arrays and strings. It also discusses rules for naming variables and identifiers. Comments, keywords, expressions, statements, and blocks are defined.
Structured Languages- Need and Characteristics of OOP, Data Types and Modifiers, Arrays, Classes, Objects, Pointers, References, Difference between Pointers and References, Inheritance, Constructors, Destructors, and Polymorphism.
This document provides an overview of the C programming language development process. It discusses the different phases a C program goes through from editing the source code to execution. It describes the preprocessor, compiler, linker, and loader and their roles. It also covers C program structures like comments, header files, and the main function. Finally, it discusses some C fundamentals like data types, variables, literals, and variable scope.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
Assessment and Planning in Educational technology.pptxKavitha Krishnan
In an education system, it is understood that assessment is only for the students, but on the other hand, the Assessment of teachers is also an important aspect of the education system that ensures teachers are providing high-quality instruction to students. The assessment process can be used to provide feedback and support for professional development, to inform decisions about teacher retention or promotion, or to evaluate teacher effectiveness for accountability purposes.
2. Objectives
Identify the basic parts of a Java program
Differentiate among Java literals, primitive data
types, variable types ,identifiers and operators
Develop a simple valid Java program using the
concepts learned in this chapter
3. Tools you will need:
For performing the examples discussed, you will need a at least
Pentium 200-MHz computer with a minimum of 64 MB of RAM
(128 MB of RAM recommended).
You also will need the following software's:
Linux 7.1 or Windows 95/98/2000/XP/7/10 operating system.
Java JDK
Microsoft Notepad or any other text editor (Netbeans)
5. • Case Sensitivity - Java is case sensitive, which
means identifier Hello and hello would have
different meaning in Java.
• Class Names - For all class names the first letter
should be in Upper Case. If several words are
used to form a name of the class, each inner
word's first letter should be in Upper Case.
– Example class MyFirstJavaClass
6. • Method Names - All method names should
start with a Lower Case letter. If several words
are used to form the name of the method, then
each inner word's first letter should be in
Upper Case.
• Example public void myMethodName()
7. • Program File Name - Name of the program file
should exactly match the class name. Example :
Assume 'MyFirstJavaProgram' is the class name.
Then the file should be saved as
'MyFirstJavaProgram.java'
• public static void main(String args[]) - Java
program processing starts from the main()
method which is a mandatory part of every Java
program..
When saving the file, you should save it using the class name (Remember Java is case
sensitive) and append '.java' to the end of the name (if the file name and the class name
do not match your program will not compile).
8. Java Comments
are notes written to a code for documentation
purposes. Those text are not part of the program
and does not affect the flow of the program.
9. Java supports three types of comments:
C++-style single line comments,
C-style multiline comments
special javadoc comments.
10. C++-Style Comments
C++ Style comments starts with //. All the text after //
are treated as comments. For
example,
// This is a C++ style or single line comments
11. C-Style Comments
C-style comments or also called multiline comments
starts with a /* and ends with a */. All text in between
the two delimiters are treated as comments. Unlike C++
style comments, it can span multiple lines. For example,
/* this is an example of a
C style or multiline comments */
12. Special Javadoc Comments
Special Javadoc comments are used for generating an
HTML documentation for your Java programs. For
example,
/**
This is an example of special java doc comments used for n
generating an html documentation. It uses tags like:
@author Florence Balagtas
@version 1.2
*/
14. A statement is one or more lines of code terminated by
a semicolon. An example of a single statement is,
System.out.println(“Hello world”);
15. A block is one or more statements bounded by an
opening and closing curly braces that groups the
statements as one unit. Block statements can be nested
indefinitely. Any amount of white space is allowed. An
example of a block is,
public static void main( String[] args ){
System.out.println("Hello");
System.out.println("world");
}
17. • Identifiers are tokens that represent names of variables,
methods, classes, etc.
– Examples of identifiers are: Hello, main, System, out.
• Java identifiers are case-sensitive. This means that the
identifier: Hello is not the same as hello. Identifiers
must begin with either a letter, an underscore “_”, or a
dollar sign “$”. Letters may be lower or upper case.
• Identifiers cannot use Java keywords like class, public,
void, etc.
18. All Java components require names. Names used for
classes, variables and methods are called identifiers.
In Java, there are several points to remember about
identifiers. They are as follows:
All identifiers should begin with a letter (A to Z or a to z),
currency character ($) or an underscore (_).
After the first character identifiers can have any
combination of characters.
A key word cannot be used as an identifier.
Most importantly identifiers are case sensitive.
Examples of legal identifiers: age, $salary, _value, __1_value
Examples of illegal identifiers: 123abc, -salary
19. Java Keywords
are predefined identifiers reserved by Java for a
specific purpose. You cannot use keywords as names
for your variables, classes, methods …etc.
22. Variables are nothing but reserved memory locations to
store values.
This means that when you create a variable you reserve
some space in memory. Based on the data type of a variable,
the operating system allocates memory and decides what
can be stored in the reserved memory. Therefore, by
assigning different data types to variables, you can store
integers, decimals, or characters in these variables.
There are two data types available in Java:
– Primitive Data Types
– Reference/Object Data Types
23. Primitive Data Types:
byte:
Byte data type is an 8-bit signed two's complement integer.
Minimum value is -128 (-2^7)
Maximum value is 127 (inclusive)(2^7 -1)
Default value is 0
Byte data type is used to save space in large arrays, mainly in place of
integers,
since a byte is four times smaller than an int.
Example: byte a = 100 , byte b = -50
24. Primitive Data Types:
short:
Short data type is a 16-bit signed two's complement integer.
Minimum value is -32,768 (-2^15)
Maximum value is 32,767 (inclusive) (2^15 -1)
Short data type can also be used to save memory as byte data type. A
short is 2 times smaller than an int.
Default value is 0.
Example: short s = 10000, short r = -20000
25. Primitive Data Types:
int:
Int data type is a 32-bit signed two's complement integer.
Minimum value is - 2,147,483,648.(-2^31)
Maximum value is 2,147,483,647(inclusive).(2^31 -1)
Int is generally used as the default data type for integral values unless
there is a
concern about memory.
The default value is 0.
Example: int a = 100000, int b = -200000
26. Primitive Data Types:
long:
Long data type is a 64-bit signed two's complement integer.
Minimum value is -9,223,372,036,854,775,808.(-2^63)
Maximum value is 9,223,372,036,854,775,807 (inclusive). (2^63 -1)
This type is used when a wider range than int is needed.
Default value is 0L.
Example: long a = 100000L, int b = -200000L
27. Primitive Data Types:
float:
Float data type is a single-precision 32-bit IEEE 754 floating point.
Float is mainly used to save memory in large arrays of floating point
numbers.
Default value is 0.0f.
Float data type is never used for precise values such as currency.
Example: float f1 = 234.5f
28. Primitive Data Types:
double:
double data type is a double-precision 64-bit IEEE 754 floating point.
This data type is generally used as the default data type for decimal
values, generally the default choice.
Double data type should never be used for precise values such as
currency.
Default value is 0.0d.
Example: double d1 = 123.4
29. Primitive Data Types:
char:
char data type is a single 16-bit Unicode character.
Minimum value is 'u0000' (or 0).
Maximum value is 'uffff' (or 65,535 inclusive).
Char data type is used to store any character.
Example: char letterA ='A'
30. Reference Data Types:
Reference variables are created using defined
constructors of the classes. They are used to access
objects. These variables are declared to be of a specific
type that cannot be changed.
• For example, Employee, Puppy etc.
• Class objects, and various type of array variables come under
reference data type.
• Default value of any reference variable is null.
• A reference variable can be used to refer to any object of the
declared type or any compatible type.
Example: Animal animal = new Animal("giraffe");
31. Variables
- is an item of data used to store state of objects.
- a variable has a data type and a name. The data
type indicates the type of value that the variable
can hold.
- variable name must follow rules for identifiers.
32. Declaring and Initializing Variables
To declare a variable is as follows,
<data type> <name> [=initial value];
Note: Values enclosed in <> are required values, while
those values enclosed in [] are optional.
33. Here is a sample program that declares and initializes
some variables,
public class VariableSamples
{
public static void main( String[] args ){
//declare a data type with variable name
// result and boolean data type
boolean result;
//declare a data type with variable name
// option and char data type
char option;
option = 'C'; //assign 'C' to option
//declare a data type with variable name
//grade, double data type and initialized
//to 0.0
double grade = 0.0;
}
}
34. Coding Guidelines:
1. It always good to initialize your variables as you declare them.
2. Use descriptive names for your variables. Like for example, if
you want to have a variable that contains a grade for a student,
name it as, grade and not just some random letters you choose.
3. Declare one variable per line of code. For example, the variable
declarations,
– double exam=0;
– double quiz=10;
– double grade = 0;
is preferred over the declaration,
– double exam=0, quiz=10, grade=0;
35. Outputting Variable Data
In order to output the value of a certain variable, we can use the following
commands,
System.out.println()
System.out.print()
Here's a sample program,
public class OutputVariable {
public static void main( String[] args ){
int value = 10;
char x;
x = ‘A’;
System.out.println( value );
System.out.println( “The value of x=“ + x );
}
}
The program will output the following text on screen,
10
The value of x=A
36. System.out.println() vs. System.out.print()
What is the difference between the commands System.out.println() and
System.out.print()? The first one appends a newline at the end of the data to
output, while the latter doesn't. Consider the statements,
System.out.print("Hello ");
System.out.print("world!");
These statements will output the following on the screen,
Hello world!
Now consider the following statements,
System.out.println("Hello ");
System.out.println("world!");
These statements will output the following on the screen,
Hello
world!
37. Find out the statement if it is valid or
not valid:
1. int if = 100; 8. float 123abc = 88;
2. boolean –password = True; 9. short _salary=39;
3. byte student = 499001; 10. boolean enterData = 81;
4. system.out.println("Hello"); 11. * sample comment *
5. Public Void myMethodName() 12. system.out.println(abc);
6. class myFirstJavaClass{ 13. int income;
} 14. double grade = true;
7. This is a comment 15. int $gross00 = -300.33;
38. Operators
- There are arithmetic operators, relational
operators, logical operators and conditional
operators.
39. The Arithmetic Operators:
Arithmetic operators are used in mathematical expressions in the same way
that they are used in algebra. The following table lists the arithmetic operators:
Assume integer variable A holds 10 and variable B holds 20, then:
40. The Relational Operators:
There are following relational operators supported by Java language
Assume variable A holds 10 and variable B holds 20, then:
41. The Logical Operators:
The following table lists the logical operators:
Assume Boolean variables A holds true and variable B holds false, then:
43. Operator precedence defines the compiler’s order of evaluation of operators
so as to come up with an unambiguous result.
Given a complicated expression,
6%2*5+4/2+88-10
we can re-write the expression and place some parenthesis base on operator
precedence,
((6%2)*5)+(4/2)+88-10;
Coding Guidelines
To avoid confusion in evaluating mathematical operations, keep your expressions simple and use
parenthesis.
44. Find out the value of the variable / expression:
Given variables:
int student = 30;
int teacher = 4;
Boolean
45. Example Program
class Example1 {
public static void main(String args[]) {
int var1; // this declares a variable
int var2; // this declares another variable
var1 = 1024; // this assigns 1024 to var1
System.out.println("var1 contains " + var1);
var2 = var1 / 2;
System.out.print("var2 contains var1 / 2: ");
System.out.println(var2);
}
}
46. Example Program
class Example2 {
public static void main(String args[]) {
int iresult, irem;
double dresult, drem;
iresult = 10 / 3;
irem = 10 % 3;
dresult = 10.0 / 3.0;
drem = 10.0 % 3.0;
System.out.println("Result and remainder of 10 / 3: " + iresult + " " + irem);
System.out.println("Result and remainder of 10.0 / 3.0: " + dresult + " " +
drem); }
}
47. Example Program
class Example3{
public static void main(String args[]) {
int var; // this declares an int variable
double x; // this declares a floating-point variable
var = 10; // assign var the value 10
x = 10.0; // assign x the value 10.0
System.out.println("Original value of var: " + var);
System.out.println("Original value of x: " + x);
System.out.println(); // print a blank line
// now, divide both by 4
var = var / 4;
x = x / 4;
System.out.println("var after division: " + var);
System.out.println("x after division: " + x);
}
}
48. Example Program
public class Example4{
public static void main(String args[]) {
int age = 0;
age = age + 7;
System.out.println("Puppy age is : " + age);
}
}
49. Group Activity: SOLVE – GROUP –SHARE
Direction:
1. The class will be divided into groups
2. Each group shall choose a leader, a writer, a reporter
3. Answer the following exercises individually and answer the following
question as a group.
- How did you solve this exercises?
- What are the error occurred during solving this exercises?
4. You will be given ___ to do this exercises and five minutes will be given to
each group to report.
50. Exercise
1. Declaring and printing variables
Given the table below, declare the following variables with the corresponding
data types and initialization values. Output to the screen the variable names
together with the values.
The following should be the expected screen output,
Number = 10
letter = a
result = true
str = hello
51. Exercise
2. Getting the average of three numbers
Create a program that outputs the average of three numbers. Let the values of
the three numbers be, 10, 20 and 45.
The expected screen output is,
number 1 = 10
number 2 = 20
number 3 = 45
Average is = 25
52. Exercise
3. Product of four integers
Write a program that calculates and prints the product of three
integers.
Editor's Notes
You can create javadoc comments by starting the line with /** and ending it with */.
Like C-style comments, it can also span lines. It can also contain certain tags to add more information to your comments.