The document discusses a Java program that solves linear equations. It begins by outlining objectives and analyzing the problem of solving for one variable in an equation of the form "ax + b = 0". It then shows the initial coding of a simple program to solve a specific case. The document goes on to discuss improving the program by making it more general and introducing object-oriented programming concepts like classes, methods and information hiding. It provides annotated code and explanations for a class called LinearEquationSolver that takes parameters to solve any linear equation, unless the coefficient of x is 0.
This contains the lecture about how to read data from the console. And obviously it contains also other information: about UML, about TextIO class and other stuff. See also http://abouthydrology.blogspot.it/2013/07/java-for-hydrologists-101.html for more information and for the other slides
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.
This document discusses Java data types and variables. It defines variables as containers that hold data values and notes there are three types: local, instance, and static. Local variables are declared within methods while instance variables are declared in a class but outside methods. Static variables can be accessed by the class name. The document also outlines Java's primitive data types like int and double, and non-primitive types like Strings and Arrays. It explains type casting between primitive types and differences between primitive and non-primitive data types.
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 overview of Unit 1 and Unit 2 of the B.Tech II Yr II Semester course. Unit 1 covers object-oriented programming concepts like classes, inheritance, polymorphism over 5 lectures. The slides cover topics such as the need for OOP, classes and instances, method binding and exceptions. Unit 2 covers Java fundamentals like data types, variables, control statements and classes over 7 lectures across 85 slides, including the history of Java and its evolution from C and C++.
C++ [ principles of object oriented programming ]Rome468
C++ is an enhanced version of C that adds support for object-oriented programming. It includes everything in C and allows for defining classes and objects. Classes allow grouping of related data and functions, and objects are instances of classes. Key concepts of OOP supported in C++ include encapsulation, inheritance, and polymorphism. Encapsulation binds data and functions together in a class and allows hiding implementation details. Inheritance allows defining new classes based on existing classes to reuse their functionality. Polymorphism enables different classes to have similarly named functions that demonstrate different behavior.
This document outlines the topics covered in a Java SE 8 Fundamentals course, including creating Java programs and classes, working with variables and data types, conditional statements, loops, arrays, objects and classes, methods, encapsulation, inheritance, interfaces, exceptions, and more. It also provides the course objectives of writing Java code using common language elements and APIs, handling exceptions, and developing programs that incorporate object-oriented design principles.
This contains the lecture about how to read data from the console. And obviously it contains also other information: about UML, about TextIO class and other stuff. See also http://abouthydrology.blogspot.it/2013/07/java-for-hydrologists-101.html for more information and for the other slides
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.
This document discusses Java data types and variables. It defines variables as containers that hold data values and notes there are three types: local, instance, and static. Local variables are declared within methods while instance variables are declared in a class but outside methods. Static variables can be accessed by the class name. The document also outlines Java's primitive data types like int and double, and non-primitive types like Strings and Arrays. It explains type casting between primitive types and differences between primitive and non-primitive data types.
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 overview of Unit 1 and Unit 2 of the B.Tech II Yr II Semester course. Unit 1 covers object-oriented programming concepts like classes, inheritance, polymorphism over 5 lectures. The slides cover topics such as the need for OOP, classes and instances, method binding and exceptions. Unit 2 covers Java fundamentals like data types, variables, control statements and classes over 7 lectures across 85 slides, including the history of Java and its evolution from C and C++.
C++ [ principles of object oriented programming ]Rome468
C++ is an enhanced version of C that adds support for object-oriented programming. It includes everything in C and allows for defining classes and objects. Classes allow grouping of related data and functions, and objects are instances of classes. Key concepts of OOP supported in C++ include encapsulation, inheritance, and polymorphism. Encapsulation binds data and functions together in a class and allows hiding implementation details. Inheritance allows defining new classes based on existing classes to reuse their functionality. Polymorphism enables different classes to have similarly named functions that demonstrate different behavior.
This document outlines the topics covered in a Java SE 8 Fundamentals course, including creating Java programs and classes, working with variables and data types, conditional statements, loops, arrays, objects and classes, methods, encapsulation, inheritance, interfaces, exceptions, and more. It also provides the course objectives of writing Java code using common language elements and APIs, handling exceptions, and developing programs that incorporate object-oriented design principles.
This is a presentation I did for the Cedar Rapids .NET User Group (CRineta.org). It was intended to present object oriented concepts and their application in .NET and C#.
This document provides an overview of object-oriented programming (OOP) including:
- The history and key concepts of OOP like classes, objects, inheritance, polymorphism, and encapsulation.
- Popular OOP languages like C++, Java, and Python.
- Differences between procedural and OOP like top-down design and modularity.
Object Oriented Programming using C++ Part IIAjit Nayak
Object Oriented Concepts
Class & Objects in C++
Constructor & Destructors in C++
Operator Overloading in C++
Friend function in C++
Data Conversion in C++
This pointer in C++
Friend class in C++
Nested Class in C++
This document contains slides from a lecture on Java basics. It covers:
- A brief history of Java and how it works by using bytecode and a Java Virtual Machine for platform independence.
- Java's data types including primitives and classes/objects.
- How to write a simple Java program, compile and run it, and basic program structure.
- Other basics like variables, methods, control structures, and exceptions.
The slides provide examples and explanations of core Java concepts to teach students the fundamentals of the language.
Intro to Object Oriented Programming with Java Hitesh-Java
In this core java training session, you will learn Object Oriented Programming. Topics covered in this session are:
• Object Oriented Programming Concepts
• Introduction to OO Analysis and Design
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
This document provides an introduction to the Java Development Kit (JDK). It discusses the key components of the JDK including the Java compiler (javac), Java Virtual Machine (JVM), Java API, and Java Runtime Environment (JRE). It also covers Java bytecode, data types in Java, type conversion and casting, ASCII vs Unicode encodings, and differences between J2SE, J2ME, and J2EE.
This document discusses method handles and lambda expressions in Java 8. It explains that method handles are references to methods that can be executed and are obtained through reflection. Method handles improve on reflection by caching access at lookup rather than invocation time. Lambda expressions allow anonymous blocks of code and are implemented using invokedynamic and method handles. When the compiler encounters a lambda expression, it is "desugared" into a private method and an invokedynamic instruction generates an instance of a functional interface to reference the lambda expression.
Java is an object-oriented programming language that can be used to create complete applications. It is simple, secure, platform independent and follows the principle of "write once, run anywhere". The key components of Java are the JDK, JRE, and JVM. Java source code is compiled to bytecode, which is then executed by the JVM. Java supports basic data types as well as object-oriented features like classes, objects, inheritance and polymorphism. Common constructs in Java include if/else statements, loops, methods, and arrays. Objects are created using the new keyword and referencing a class.
java: basics, user input, data type, constructorShivam Singhal
The document provides an overview of some key Java concepts including classes, attributes, methods, objects, constructors, and data types. It explains that classes contain attributes and methods, and that objects are instantiated from classes using constructors. It also describes static and non-static methods, with static methods not requiring an object to be called. The main method is used to control program flow. User input can be obtained through command line arguments, Scanner, or BufferedReader classes.
Review Session and Attending Java Interviews Hitesh-Java
This document provides an overview of core Java concepts for a training session. It includes interview tips for Java positions and discusses Java advantages over other languages. Key topics covered include packages, static blocks, constructors vs methods, calling constructors, inheritance vs composition, abstract classes vs interfaces, method overloading and overriding, access modifiers, autoboxing/unboxing examples, and differences between String, StringBuffer and StringBuilder. Examples of collections like Lists and Sets are also provided along with an outline of topics to cover in the next session on Maps.
This document provides an introduction to object oriented programming concepts in Java. It discusses key topics like what a computer is, developer skills, memory management, and an introduction to Java. Object oriented programming principles like inheritance, abstraction, encapsulation, and polymorphism are defined. The document also covers exceptions in Java like defining exceptions, reasons they occur, and handling exceptions.
The document discusses key concepts in Object Oriented Programming including objects, classes, inheritance, polymorphism, abstraction, and encapsulation. It defines each concept and provides examples. Objects have state, behavior, and identity. A class is a template for creating objects that share common properties. Inheritance allows an object to acquire properties of a parent object. Polymorphism allows one task to be performed in different ways. Abstraction hides internal details and shows functionality. Encapsulation binds code and data into a single unit.
The document provides an introduction to object-oriented programming concepts and Java. It discusses key OOP concepts like objects, classes, encapsulation, inheritance, and polymorphism. It also explains the basics of Java, including its history, features like being platform independent and secure, and the structure of a Java program with main components like packages, import statements, and class definitions.
This document provides an introduction to object-oriented programming (OOP) concepts. It defines OOP as a design philosophy that groups everything as self-sustainable objects. The key OOP concepts discussed are objects, classes, encapsulation, abstraction, inheritance, polymorphism, method overloading, method overriding, and access modifiers. Objects are instances of classes that can perform related activities, while classes are blueprints that describe objects. Encapsulation hides implementation details within classes, and abstraction focuses on what objects are rather than how they are implemented.
The document discusses object-oriented programming concepts like inheritance, subclasses, and polymorphism. It provides examples of different forms of inheritance including:
1. Inheritance for specialization where a child class is a specialized form of the parent class and the principle of substitutability holds.
2. Inheritance for specification where a parent class specifies behavior but doesn't implement it, and child classes implement the behavior, like with interfaces and abstract classes.
3. Inheritance for construction where a child class inherits functionality from a parent but may change method names/parameters, primarily for code reuse rather than creating a subtype relationship.
The document discusses basic Java concepts including identifiers, keywords, literals, primitive data types, variables, operators, control flow statements, classes, methods, inheritance, polymorphism, packages and modifiers. It provides definitions and examples of key concepts like classes, objects, methods, inheritance, polymorphism, packages, modifiers, variables and data types. It also lists Java keywords, reserved words and literals.
This document discusses object-oriented design principles including encapsulation, abstraction, inheritance, polymorphism, and decoupling. It then introduces the SOLID principles of object-oriented design: single responsibility principle, open/closed principle, Liskov substitution principle, interface segregation principle, and dependency inversion principle. Code examples are provided to demonstrate how to apply these principles and improve code maintainability, reusability, and testability.
Comparison of remote sensing soil moisture dataset across a range of spatial ...ICGCat
Presentació realitzada per Maria Jose Escorihuela, Pere Quintana-Seguí i Olivier Merlin (IsardSat) a la jornada "Validació de dades teletransportades en camp; Aplicacions agrícoles i hidrogeològiques" (03/06/2016)
This is a presentation I did for the Cedar Rapids .NET User Group (CRineta.org). It was intended to present object oriented concepts and their application in .NET and C#.
This document provides an overview of object-oriented programming (OOP) including:
- The history and key concepts of OOP like classes, objects, inheritance, polymorphism, and encapsulation.
- Popular OOP languages like C++, Java, and Python.
- Differences between procedural and OOP like top-down design and modularity.
Object Oriented Programming using C++ Part IIAjit Nayak
Object Oriented Concepts
Class & Objects in C++
Constructor & Destructors in C++
Operator Overloading in C++
Friend function in C++
Data Conversion in C++
This pointer in C++
Friend class in C++
Nested Class in C++
This document contains slides from a lecture on Java basics. It covers:
- A brief history of Java and how it works by using bytecode and a Java Virtual Machine for platform independence.
- Java's data types including primitives and classes/objects.
- How to write a simple Java program, compile and run it, and basic program structure.
- Other basics like variables, methods, control structures, and exceptions.
The slides provide examples and explanations of core Java concepts to teach students the fundamentals of the language.
Intro to Object Oriented Programming with Java Hitesh-Java
In this core java training session, you will learn Object Oriented Programming. Topics covered in this session are:
• Object Oriented Programming Concepts
• Introduction to OO Analysis and Design
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
This document provides an introduction to the Java Development Kit (JDK). It discusses the key components of the JDK including the Java compiler (javac), Java Virtual Machine (JVM), Java API, and Java Runtime Environment (JRE). It also covers Java bytecode, data types in Java, type conversion and casting, ASCII vs Unicode encodings, and differences between J2SE, J2ME, and J2EE.
This document discusses method handles and lambda expressions in Java 8. It explains that method handles are references to methods that can be executed and are obtained through reflection. Method handles improve on reflection by caching access at lookup rather than invocation time. Lambda expressions allow anonymous blocks of code and are implemented using invokedynamic and method handles. When the compiler encounters a lambda expression, it is "desugared" into a private method and an invokedynamic instruction generates an instance of a functional interface to reference the lambda expression.
Java is an object-oriented programming language that can be used to create complete applications. It is simple, secure, platform independent and follows the principle of "write once, run anywhere". The key components of Java are the JDK, JRE, and JVM. Java source code is compiled to bytecode, which is then executed by the JVM. Java supports basic data types as well as object-oriented features like classes, objects, inheritance and polymorphism. Common constructs in Java include if/else statements, loops, methods, and arrays. Objects are created using the new keyword and referencing a class.
java: basics, user input, data type, constructorShivam Singhal
The document provides an overview of some key Java concepts including classes, attributes, methods, objects, constructors, and data types. It explains that classes contain attributes and methods, and that objects are instantiated from classes using constructors. It also describes static and non-static methods, with static methods not requiring an object to be called. The main method is used to control program flow. User input can be obtained through command line arguments, Scanner, or BufferedReader classes.
Review Session and Attending Java Interviews Hitesh-Java
This document provides an overview of core Java concepts for a training session. It includes interview tips for Java positions and discusses Java advantages over other languages. Key topics covered include packages, static blocks, constructors vs methods, calling constructors, inheritance vs composition, abstract classes vs interfaces, method overloading and overriding, access modifiers, autoboxing/unboxing examples, and differences between String, StringBuffer and StringBuilder. Examples of collections like Lists and Sets are also provided along with an outline of topics to cover in the next session on Maps.
This document provides an introduction to object oriented programming concepts in Java. It discusses key topics like what a computer is, developer skills, memory management, and an introduction to Java. Object oriented programming principles like inheritance, abstraction, encapsulation, and polymorphism are defined. The document also covers exceptions in Java like defining exceptions, reasons they occur, and handling exceptions.
The document discusses key concepts in Object Oriented Programming including objects, classes, inheritance, polymorphism, abstraction, and encapsulation. It defines each concept and provides examples. Objects have state, behavior, and identity. A class is a template for creating objects that share common properties. Inheritance allows an object to acquire properties of a parent object. Polymorphism allows one task to be performed in different ways. Abstraction hides internal details and shows functionality. Encapsulation binds code and data into a single unit.
The document provides an introduction to object-oriented programming concepts and Java. It discusses key OOP concepts like objects, classes, encapsulation, inheritance, and polymorphism. It also explains the basics of Java, including its history, features like being platform independent and secure, and the structure of a Java program with main components like packages, import statements, and class definitions.
This document provides an introduction to object-oriented programming (OOP) concepts. It defines OOP as a design philosophy that groups everything as self-sustainable objects. The key OOP concepts discussed are objects, classes, encapsulation, abstraction, inheritance, polymorphism, method overloading, method overriding, and access modifiers. Objects are instances of classes that can perform related activities, while classes are blueprints that describe objects. Encapsulation hides implementation details within classes, and abstraction focuses on what objects are rather than how they are implemented.
The document discusses object-oriented programming concepts like inheritance, subclasses, and polymorphism. It provides examples of different forms of inheritance including:
1. Inheritance for specialization where a child class is a specialized form of the parent class and the principle of substitutability holds.
2. Inheritance for specification where a parent class specifies behavior but doesn't implement it, and child classes implement the behavior, like with interfaces and abstract classes.
3. Inheritance for construction where a child class inherits functionality from a parent but may change method names/parameters, primarily for code reuse rather than creating a subtype relationship.
The document discusses basic Java concepts including identifiers, keywords, literals, primitive data types, variables, operators, control flow statements, classes, methods, inheritance, polymorphism, packages and modifiers. It provides definitions and examples of key concepts like classes, objects, methods, inheritance, polymorphism, packages, modifiers, variables and data types. It also lists Java keywords, reserved words and literals.
This document discusses object-oriented design principles including encapsulation, abstraction, inheritance, polymorphism, and decoupling. It then introduces the SOLID principles of object-oriented design: single responsibility principle, open/closed principle, Liskov substitution principle, interface segregation principle, and dependency inversion principle. Code examples are provided to demonstrate how to apply these principles and improve code maintainability, reusability, and testability.
Comparison of remote sensing soil moisture dataset across a range of spatial ...ICGCat
Presentació realitzada per Maria Jose Escorihuela, Pere Quintana-Seguí i Olivier Merlin (IsardSat) a la jornada "Validació de dades teletransportades en camp; Aplicacions agrícoles i hidrogeològiques" (03/06/2016)
This document summarizes a presentation on agricultural remote sensing. It discusses how satellite and aircraft imagery can provide spatially complete information on large or inaccessible regions. Such imagery can support activities like land management, biomass estimation and monitoring. The document highlights several current remote sensing activities by AAFC, including near-real-time soil moisture and crop condition mapping using satellite data. It also discusses how remote sensing combined with ground data can help assess crop rotations and nitrogen needs. Overall, the document promotes the use of remote sensing to make better agricultural management decisions.
Surface Water modelling using Remote SensingArk Arjun
1) The document discusses remote sensing and runoff estimation using the SCS curve number method. Remote sensing involves obtaining information about objects through non-contact sensors.
2) Runoff estimation is the first step in water management. The SCS-CN method estimates runoff as a function of land use, soil type, and rainfall.
3) The study area's topographic maps, rainfall data, land use maps, and soil data were collected and used to classify land cover, model rainfall-runoff, and estimate runoff volume using the SCS-CN method.
Remote Sensing Based Soil Moisture DetectionCIMMYT
Remote sensing –Beyond images
Mexico 14-15 December 2013
The workshop was organized by CIMMYT Global Conservation Agriculture Program (GCAP) and funded by the Bill & Melinda Gates Foundation (BMGF), the Mexican Secretariat of Agriculture, Livestock, Rural Development, Fisheries and Food (SAGARPA), the International Maize and Wheat Improvement Center (CIMMYT), CGIAR Research Program on Maize, the Cereal System Initiative for South Asia (CSISA) and the Sustainable Modernization of the Traditional Agriculture (MasAgro)
This document provides an overview of measuring soil moisture using digital image processing. It begins with an introduction stating that soil moisture content is important for crop growth and needs to be measured online. It then describes applying digital image processing techniques to images of soil layers to extract the gray value characteristic, and analyzing the relationship between gray value and soil moisture content. Experimental results showed an approximate linear relationship between soil moisture percentage and image gray value.
This document discusses methods for estimating soil moisture content. It defines soil moisture as the water held in the spaces between soil particles, particularly in the top 200 cm that is available to plants. There are direct methods that measure the moisture content through gravimetric techniques like oven drying samples, and volumetric methods using bulk density. Indirect methods measure water potential or tension, including tensiometers, gypsum blocks, and neutron probes. Remote sensing techniques estimate soil moisture from visible/infrared reflectance, thermal infrared surface temperature, and passive/active microwave emissions and backscattering related to dielectric properties.
This document discusses using remote sensing for agricultural drought monitoring in China. It presents several methods:
1) Various remote sensing indices are used to monitor vegetation conditions, surface temperature, and soil moisture from sensors including AVHRR and MODIS.
2) Models are developed to relate the indices to soil moisture measurements from monitoring stations.
3) The models are validated and incorporated into an operational drought monitoring system called DroughtWatch to monitor drought conditions across China.
This document discusses soil moisture monitoring for irrigation water management. It outlines different options for monitoring soil moisture, including gypsum blocks, tensiometers, and the feel method. It explains how to place sensors in the field, focusing on the active root zone. The document also discusses using the data collected, such as graphing it over time and using a checkbook method to determine irrigation needs based on the soil's water holding capacity.
1. The document discusses water management strategies for wheat crops, including determining optimal irrigation times, depths, and methods.
2. Key irrigation times for wheat include crown root initiation, late tillering, late joining, flowering, milk stage, and dough stage. The number of irrigations depends on soil type but generally ranges from 3-8.
3. Other water management techniques discussed include using hydrogel amendments, implementing irrigation strategies based on water availability, adopting micro irrigation systems like sprinklers and drip, and using deficit irrigation and straw mulch to increase wheat yield and quality with less water.
Operational Agriculture Monitoring System Using Remote SensingMary Adel
This document discusses using remote sensing for operational agricultural monitoring. It describes how remote sensing can be applied to monitor vegetation, soil, forests, and land cover. Applications of remote sensing discussed include crop type identification, crop condition assessment, crop area estimation, crop growth monitoring, crop yield prediction, and crop damage assessment. The document outlines methodologies for crop area estimation, crop growth monitoring, and crop yield estimation that utilize remote sensing data like NDVI. It also discusses using field networks for validation and improving monitoring accuracy.
Remote sensing analysis of high resolution satellite images can help monitor Grapevine Flavescence dorée phytoplasma (FD), a disease affecting grapevines. The study analyzed satellite images from vineyards in coastal and central Slovenia to detect FD symptoms. Spectral signatures were analyzed using indices like NDVI and WBI to distinguish between healthy and diseased plants. While full detection certainty may not be possible, the results can help target FD monitoring in vineyards and locate possible outbreaks in isolated areas. Cooperation with local experts provided ground truthing data to analyze the images.
Remote sensing can be used to study soils by analyzing parameters like surface color, temperature, moisture, vegetation indices, mineralogy, organic carbon, iron content, and salinity. High resolution DEM and imagery from sensors like LIDAR and SAR can be used to map landforms and classify soils. Traditional soil mapping is done at scales of 1:1 million to 1:50,000. Remote sensing allows soil mapping across large areas by analyzing the spectral response patterns influenced by soil properties.
Application of remote sensing in agriculturevajinder kalra
The document discusses the concepts and applications of remote sensing, GIS, and GPS in agriculture. It defines remote sensing as sensing things from a distance using electromagnetic radiation and describes the different platforms (ground, air, satellite) used. It explains key remote sensing concepts including spectral signatures, spectral reflectance curves, spatial/spectral/radiometric/temporal resolutions, and indices like NDVI. Interpretation of remote sensing imagery involves analyzing tone, shape, size, pattern, texture, shadow, and association. Spectral signatures can provide information about vegetation, soil moisture, organic matter, iron content, and other properties. Remote sensing allows monitoring and analyzing agriculture from a distance.
Application of Remote Sensing in AgricultureUTTAM KUMAR
Remote sensing has been found to be a valuable tool in evaluation, monitoring and management of land, water and crop resources. The launching of the Indian remote sensing satellite (IRS) has enhanced the capabilities for better utilization of this technology and significant progress has been made in soil and land cover mapping, land degradation studies, monitoring of waste land, assessment of crop conditions crop acreage and production estimates
Application of gis and remote sensing in agricultureRehana Qureshi
This document summarizes the applications of remote sensing and GIS in agriculture as presented by Rehana Khaliq. It discusses how GIS systems capture and analyze geospatial data to integrate information and perform analysis. Remote sensing is defined as obtaining information about objects without physical contact using sensors. The document outlines how remote sensing and GIS have been applied to agriculture for tasks like crop mapping and monitoring, yield estimation, and precision agriculture. It also discusses their applications in forestry, land use mapping, and urban planning. While remote sensing provides valuable data, it notes that measurement errors and data interpretation can sometimes be challenging. In conclusion, the document argues that remote sensing and GIS are promising tools to enhance sustainable agriculture and development through
This document provides an overview of remote sensing through a seminar presented by Ashwathy Babu Paul. It defines remote sensing as obtaining information about an object without physical contact through electromagnetic radiation. It describes the basic components and process of remote sensing systems including energy sources, sensor recording, transmission and processing. Various sensors and platforms are discussed along with advantages and applications in fields like agriculture, natural resource management, national security, geology, meteorology, and more. Challenges are addressed but advantages of remote sensing are said to far outweigh these.
The document provides an overview of the Java programming language and platform. It discusses the Java language basics including variables, operators, control flow statements, and primitive data types. It also covers object-oriented programming concepts, classes and objects, exceptions, and concurrency. Finally, it outlines the Java platform components including the Java Virtual Machine and Java API.
This document provides an overview of key object-oriented programming concepts in Java including classes, objects, encapsulation, inheritance, polymorphism, abstraction, interfaces, exception handling, and static methods. It includes examples of defining classes with properties and methods, creating objects, and using inheritance. Specific concepts like method overloading, overriding, and exception handling are demonstrated through code examples. The document also discusses data types, control statements, and static methods in Java.
This document provides an overview of Java programming concepts for a class. It discusses the intended audience, history of Java versions, core design principles, what Java is and isn't, comparing Java to C, compiling and running a first Java program, basic programming constructs like data types, operators, control flow, and arrays. It also covers parsing string input, reading keyboard input at runtime, and where to find Java class documentation online. The overall summary is an introduction to Java programming concepts aimed at students new to 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.
This document summarizes several programming languages that are currently in development or may be enhanced in the future, including Python 3000, Ruby 2, Groovy, and Scala. Python 3000 is an upcoming version of Python that will include changes like multi-line imports and reverse iteration. Ruby 2 promises improvements like bytecode compilation and thread safety. Groovy is designed for the Java platform and includes features like closures. Scala combines object-oriented and functional programming with a static type system and interoperability with Java.
A web browser takes you anywhere on the internet, letting you see text, images and video from anywhere in the world. ... The web is a vast and powerful tool. Over .
This document provides an overview of object oriented programming concepts in Java including classes, objects, encapsulation, inheritance, polymorphism and more. It also outlines the syllabus for a course on OOP with Java, covering topics like arrays, strings, vectors, exception handling, GUI programming and more. Finally, it provides some examples of basic Java code.
This document provides an overview and introduction to the C# programming language. It begins with setting up the environment needed to code in C#, which includes Visual Studio and a Windows PC. The document then discusses basic C# syntax like data types, variables, operators, and conditional statements. It also covers arrays, strings, and encapsulation. The goal is to provide beginners with an understanding of fundamental C# concepts to get started with the language.
C++ is an object-oriented programming language that is an incremented version of C with classes added. Some key differences between C and C++ are that C++ uses object-oriented programming with classes that can contain both data and functions, while C focuses more on procedures/functions and allows any function to access data. The document then discusses the basic concepts of object-oriented programming in C++ including classes, objects, polymorphism, inheritance, encapsulation, and data abstraction. It provides examples of classes, objects, reference variables, default arguments, and dynamic memory allocation in C++.
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...Sagar Verma
OOPS and its application in Java, Super class AND This Keyword,Java Bean, POJO ,Memory management in Java ,Packages ,Miscellaneous (Var-Args, toString(), Double equals operator(==))
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.
This document provides an overview of core Java basics. It discusses:
- The origins and evolution of Java from its initial release in 1995 to current versions.
- Key characteristics of Java including being object-oriented, platform independent, simple, robust, and distributed.
- The Java environment setup and basic syntax including classes, objects, and methods.
- A simple "Hello World" example Java program.
- Explanations of primitive data types in Java like int, float, boolean and others.
- An overview of object-oriented programming concepts in Java like abstraction, encapsulation, inheritance and polymorphism.
This document provides an overview of core Java basics. It discusses:
- The origins and evolution of Java from its initial release in 1995 to current versions.
- Key characteristics of Java including being object-oriented, platform independent, simple, robust, and distributed.
- The Java environment setup and basic syntax including classes, objects, and methods.
- A simple "Hello World" example Java program.
- Primitive data types in Java like int, float, boolean and how they differ.
- Object-oriented programming concepts in Java such as abstraction, encapsulation, inheritance and polymorphism.
The document provides an overview of core Java basics. It discusses that Java was originally developed by Sun Microsystems and the latest release is Java SE 8. It also explains that Java is object-oriented, platform independent, simple, architecture neutral, portable, robust, multithreaded, interpreted and distributed. The document then discusses Java environment setup, basic syntax including classes, objects and methods. It also covers primitive data types, constructors, OOP concepts like abstraction, encapsulation, inheritance and polymorphism.
This document provides an overview of a Java programming fundamentals course. It discusses the history and development of Java, how Java works, and some of its core features. Some key points:
- Java was created in the early 1990s by James Gosling at Sun Microsystems to be platform independent through the use of bytecode and the Java Virtual Machine.
- A Java program consists of classes that contain methods and can create objects. Everything must be contained within a class.
- The document reviews Java's basic data types including primitives like int and double, as well as classes. It also covers expressions, control structures like if/else statements and loops, and built-in classes like String and Math.
JAVA - A Quick Reference
A quick guide to learn more about JAVA Programming. This covers the core concepts of JAVA with OOP concepts. This also covers swing programming.
INDUMATHY- UNIT 1 cs3391 oops introduction to oop and java.pptxIndu65
This document provides an introduction to Java programming language and some of its core concepts. It discusses:
- The origins and features of Java like being architecture neutral, robust, multithreaded, object-oriented, platform independent, simple and secure.
- Basic Java syntax including classes, objects, methods, and variables.
- Key object-oriented programming concepts in Java like encapsulation, inheritance, polymorphism and abstraction.
- Examples of basic Java programs and code snippets demonstrating classes, objects, methods, variables and data types.
- Common programming structures in Java like control statements, operators, and constructors.
This document discusses the use of satellite soil moisture data for hydrological applications. It summarizes research validating satellite soil moisture products against in situ observations across different scales. It also describes a method called SM2RAIN that estimates rainfall from satellite soil moisture observations by inverting the soil water balance equation. Initial tests of SM2RAIN show good agreement between estimated and observed rainfall.
This is the implementation with explanations of a Hello World simple program. It is useful to document keyword and Java modifiers, as well as how to execute a program.
The document provides an introduction to using the Eclipse Java IDE for beginners learning Java. It recommends first understanding basic Java concepts by reading introductory books before using an IDE. It then directs the reader to an external website that provides instructions on installing and using Eclipse's basic features. The document stresses the importance of self-practice and mentions several other tools like Git, Ant, and Maven that programmers should learn but doesn't provide details as the author is also still learning.
The document discusses water and energy budgets. It explains that a budget represents the variation of a given quantity within a control volume over a time interval, and is the algebraic sum of inputs and outputs. It provides examples of water budgets for soil volumes and atmospheric layers, accounting for precipitation, evapotranspiration, runoff and other fluxes. It also discusses the components of an energy budget, including net radiation, heat conduction, heat of vaporization and more.
The document summarizes the activities of the Platform Water Management in the Alps over the past two years and outlines its planned activities for the next period. It discusses workshops held on sediment management, hydropeaking, and hydropower that brought together administrators, practitioners, and stakeholders. It also describes dissemination of guidelines on small hydropower and platform meetings. Going forward, the document outlines three planned workshops on local adaptation to climate change, flood risk prevention, and river management, as well as a conference on water in the Alps. The goals are to address EU directives in an alpine context and local adaptation to climate change.
The document provides an introduction to hydrology, including:
- Defining hydrology as the science studying the water cycle and flows between the atmosphere, land, and oceans.
- Describing the key elements of the water cycle, including precipitation, infiltration, evaporation, and the spatial and temporal scales involved.
- Noting that the water cycle sustains life on Earth, shapes its surface, and regulates the climate.
This document provides an introduction to solar radiation and its role in powering the water cycle. It discusses the composition and structure of the Sun, and how it produces radiation through nuclear fusion. While solar radiation is generally constant, it exhibits variations in the form of solar spots and an 11-year activity cycle. The amount of radiation emitted by any body is determined by the Stefan-Boltzmann law, which relates radiation to the body's temperature and emissivity.
The document discusses the measurement and representation of hydrological quantities. It notes that hydrological data has complex trends that are nonlinear and influenced by many factors. Statistical tools must be used to describe hydrological quantities given their spatiotemporal variability. Examples of typical problems in measuring quantities like precipitation, river flows, and soil moisture are provided.
The document discusses various hydrological measurement quantities and instruments. It describes 8 main hydrological quantities of interest: temperature, humidity, precipitation, radiation, wind, pressure, wetting, and evapotranspiration. It then explains principles and instruments for measuring temperature, humidity, and soil moisture, including thermometers, hygrometers, psychrometers, lysimeters, tensiometers, and instruments measuring electrical conductivity, thermal conductivity, and dielectric constants.
This document discusses peak river flows and flow hydrology. It introduces the concept of a peak flow, shows a graph of discharge over time as an example, and discusses precipitation patterns and the calculation of effective precipitation. It also discusses the instantaneous unit hydrograph method for summing surface runoff over a basin to determine discharge at the basin outlet.
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
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.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPRAHUL
This Dissertation explores the particular circumstances of Mirzapur, a region located in the
core of India. Mirzapur, with its varied terrains and abundant biodiversity, offers an optimal
environment for investigating the changes in vegetation cover dynamics. Our study utilizes
advanced technologies such as GIS (Geographic Information Systems) and Remote sensing to
analyze the transformations that have taken place over the course of a decade.
The complex relationship between human activities and the environment has been the focus
of extensive research and worry. As the global community grapples with swift urbanization,
population expansion, and economic progress, the effects on natural ecosystems are becoming
more evident. A crucial element of this impact is the alteration of vegetation cover, which plays a
significant role in maintaining the ecological equilibrium of our planet.Land serves as the foundation for all human activities and provides the necessary materials for
these activities. As the most crucial natural resource, its utilization by humans results in different
'Land uses,' which are determined by both human activities and the physical characteristics of the
land.
The utilization of land is impacted by human needs and environmental factors. In countries
like India, rapid population growth and the emphasis on extensive resource exploitation can lead
to significant land degradation, adversely affecting the region's land cover.
Therefore, human intervention has significantly influenced land use patterns over many
centuries, evolving its structure over time and space. In the present era, these changes have
accelerated due to factors such as agriculture and urbanization. Information regarding land use and
cover is essential for various planning and management tasks related to the Earth's surface,
providing crucial environmental data for scientific, resource management, policy purposes, and
diverse human activities.
Accurate understanding of land use and cover is imperative for the development planning
of any area. Consequently, a wide range of professionals, including earth system scientists, land
and water managers, and urban planners, are interested in obtaining data on land use and cover
changes, conversion trends, and other related patterns. The spatial dimensions of land use and
cover support policymakers and scientists in making well-informed decisions, as alterations in
these patterns indicate shifts in economic and social conditions. Monitoring such changes with the
help of Advanced technologies like Remote Sensing and Geographic Information Systems is
crucial for coordinated efforts across different administrative levels. Advanced technologies like
Remote Sensing and Geographic Information Systems
9
Changes in vegetation cover refer to variations in the distribution, composition, and overall
structure of plant communities across different temporal and spatial scales. These changes can
occur natural.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
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.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
3 jf h-linearequations
1. Riccardo Rigon
Java for Hydrologists
Linear Equations
R.Rigon-IltavolodilavorodiRemowolf
Wednesday, September 4, 13
2. A program must be:
- short
- readable
- robust
- correct
- manageable
- documented
Not necessarily in this order of importance
Wednesday, September 4, 13
3. Objectives
Writing and commenting a program that solves a linear equation
Introduction
•Writing a bare-bone program that exploits some features of OO
•Introducing tools for I/O
•Talking of other various aspects of programming at convenience
R. Rigon
Wednesday, September 4, 13
4. Problem analysis
The problem is quite trivial. We look for the solution of a single linear
equation:
One solution is known to exist and be equal to:
R. Rigon
Problem analysis
Wednesday, September 4, 13
5. package org.geoframe.first;
public class linearequation {
static double a=1;
static double b=-2;
! public static void main(String[] args) {
! ! System.out.println( - b/a);
! }
}
Here the simplest program
actually this solves a particular case:
Various things to note: for the first time we have defined variable these two
variables are said to be static double
R. Rigon
Coding right away
Wednesday, September 4, 13
6. static (when applied to a variable):
• It is a variable which belongs to the class and not to object
(instance)
• Static variables are initialized only once , at the start of the
execution . These variables will be initialized first, before the
initialization of any instance variables
• A single copy to be shared by all instances of the class
• A static variable can be accessed directly by the class name and
doesn’t need any object
• Syntax : <class-name>.<variable-name>
R. Rigon
Java
Wednesday, September 4, 13
7. double:
is the representation of real numbers in a computer,
• the double data type is a double-precision 64-bit IEEE 754 floating point. Its
range of values is beyond the scope of this discussion, but is specified in the
Floating-Point Types, Formats, and Values section of the Java Language
Specification. For decimal values, this data type is generally the default
choice. As mentioned above, this data type should never be used for precise
values, such as currency.
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
R. Rigon
Java
Wednesday, September 4, 13
8. •byte: The byte data type is an 8-bit signed two's complement integer. It
has a minimum value of -128 and a maximum value of 127 (inclusive).
The byte data type can be useful for saving memory in large arrays,
where the memory savings actually matters. They can also be used in
place of int where their limits help to clarify your code; the fact that a
variable's range is limited can serve as a form of documentation.
•short: The short data type is a 16-bit signed two's complement integer.
It has a minimum value of -32,768 and a maximum value of 32,767
(inclusive). As with byte, the same guidelines apply: you can use a short
to save memory in large arrays, in situations where the memory savings
actually matters.
•int: The int data type is a 32-bit signed two's complement integer. It has
a minimum value of -2,147,483,648 and a maximum value of
2,147,483,647 (inclusive). For integral values, this data type is generally
the default choice unless there is a reason (like the above) to choose
something else. This data type will most likely be large enough for the
numbers your program will use, but if you need a wider range of values,
use long instead.
besides double Java implements:
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
R. Rigon
Java
Wednesday, September 4, 13
9. • long: The long data type is a 64-bit signed two's complement integer.
It has a minimum value of -9,223,372,036,854,775,808 and a
maximum value of 9,223,372,036,854,775,807 (inclusive). Use this
data type when you need a range of values wider than those provided
by int.
• float: The float data type is a single-precision 32-bit IEEE 754 floating
point. Its range of values is beyond the scope of this discussion, but is
specified in the Floating-Point Types, Formats, and Values section of
the Java Language Specification. As with the recommendations for
byte and short, use a float (instead of double) if you need to save
memory in large arrays of floating point numbers. This data type
should never be used for precise values, such as currency. For that,
you will need to use the java.math.BigDecimal class instead. Numbers
and Strings covers BigDecimaland other useful classes provided by
the Java platform.
besides double Java implements:
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
R. Rigon
Java
Wednesday, September 4, 13
10. • boolean: The boolean data type has only two possible values: true and
false. Use this data type for simple flags that track true/false
conditions. This data type represents one bit of information, but its
"size" isn't something that's precisely defined.
• char: The char data type is a single 16-bit Unicode character. It has a
minimum value of 'u0000' (or 0) and a maximum value of 'uffff' (or
65,535 inclusive).
besides double Java implements:
They are called “primitive data types” and are not object. However wrapper class
are provided (Double, Float, Boolean, etc) that have all the properties of the classes.
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
R. Rigon
Java
Wednesday, September 4, 13
11. Some further things to note:
•the variables used (that can be either primitive types or objects) must
be declared
•the variable are also initialized to a value
•declaration and initialization are inside the class, but outside the method
(in principle they can be accessed by any other method that we can add to
the class)
R. Rigon
Java
Wednesday, September 4, 13
12. Clearly we are not satisfied with this program
To satisfy our analysis, we have to:
•consider any couple of a and b
•avoid the case in which a=0
besides to solve the equation
We have three actions here, and we can think to split these actions in
various classes, and various files
R. Rigon
Java
Wednesday, September 4, 13
13. 1 - One class to input the data and control them
2 - One class to execute the task
http://docs.oracle.com/javase/tutorial/java/concepts/class.html
Classes are often said to represent physical objects.
In fact they also represent actions and algorithms, i.e. abstract concepts.
R. Rigon
Java
Wednesday, September 4, 13
14. package org.geoframe.first;
public class LinearEquationSolver {
private double a,b,sol=Double.NaN;
public LinearEquationSolver(double a, double b){
....the code here solves the equation ...
}
public double getSolution(){
....the code here accesses the solution...
}
public static void main(String[] args){
....this is useful to try the solver ...
}
}
Let’s concentrate on the task of
solving the mathematical problem
Variable declaration
methods
R. Rigon
Coding
Wednesday, September 4, 13
15. Variable declaration:
The only particular thing is the assignment to Double.NaN which is
“not a number”. This will allow, eventually some tests. Variables are
private and can be accessed only by methods inside the class.
This construct implements an object oriented concept called
information hiding.
Methods:
Of the methods one has the same name as the class, and is a constructor,
main( ) has been already covered in the previous slides’ series.
The other method is used to access the solution and make it available
by other classes.
R. Rigon
Java
Wednesday, September 4, 13
16. In computer science, information hiding is the principle of
segregation of the design decisions in a computer program that are
most likely to change, thus protecting other parts of the program
from extensive modification if the design decision is changed. The
protection involves providing a stableinterface which protects the
remainder of the program from the implementation (the details that
are most likely to change).
Written another way, information hiding is the ability to prevent
certain aspects of a class or software component from being
accessible to its clients, using either programming language features
(like private variables) or an explicit exporting policy.
http://en.wikipedia.org/wiki/Information_hiding
R. Rigon
OO
Wednesday, September 4, 13
17. A Java Constructor:
A java constructor has the same name as the name of the class
to which it belongs. Constructor’s syntax does not include a
return type, since constructors never return a value.
Constructors may include parameters of various types. When the
constructor is invoked using the new operator, the types must
match those that are specified in the constructor definition.
Java provides a default constructor which takes no arguments
and performs no special actions or initializations, when no
explicit constructors are provided.
If a constructor is explicitly provided, this overwrite the default
one and needs to be used.
However, a class can have multiple constructors
R. Rigon
Java
Wednesday, September 4, 13
18. A look to the main( ):
public static void main(String[] args){
double a =3,b=4,sol;
System.out.println("nThis is the LinearEquationSolver
main( )n");
LinearEquationSolver ll = new LinearEquationSolver(a,b);
sol=ll.getSolution();
System.out.println("The solution of "+a+" x + "+b+"
== 0 is: x = "+sol);
System.out.println("nEnd of Computationn");
}
These variables lives here. They cannot be confused with the variables with the
same names inside the class definition
R. Rigon
Code inspection
Wednesday, September 4, 13
19. public static void main(String[] args){
double a =3,b=4,sol;
System.out.println("nThis is the LinearEquationSolver
main( )n");
LinearEquationSolver ll = new LinearEquationSolver(a,b);
sol=ll.getSolution();
System.out.println("The solution of "+a+" x + "+b+"
== 0 is: x = "+sol);
System.out.println("nEnd of Computationn");
}
A look to the main( ):
This is not strictly necessary. However, as you realized, since any class can have its
main( ), this is useful to know which class you are actually executing.
R. Rigon
Code inspection
Wednesday, September 4, 13
20. public static void main(String[] args){
double a =3,b=4,sol;
System.out.println("nThis is the LinearEquationSolver
main( )n");
LinearEquationSolver ll = new LinearEquationSolver(a,b);
sol=ll.getSolution();
System.out.println("The solution of "+a+" x + "+b+"
== 0 is: x = "+sol);
System.out.println("nEnd of Computationn");
}
A look to the main( ):
This is not strictly necessary either. However, in more complex programs, which
output to files, is better to have something that tells you that the program finished.
R. Rigon
Code inspection
Wednesday, September 4, 13
21. public static void main(String[] args){
double a =3,b=4,sol;
System.out.println("nThis is the LinearEquationSolver
main( )n");
LinearEquationSolver ll = new LinearEquationSolver(a,b);
sol=ll.getSolution();
System.out.println("The solution of "+a+" x + "+b+"
== 0 is: x = "+sol);
System.out.println("nEnd of Computationn");
}
A look to the main( ):
This command makes a lot of things:
R. Rigon
Code inspection
Wednesday, September 4, 13
22. LinearEquationSolver ll = new LinearEquationSolver(a,b);
The left side is a declaration of a type LinearEquationSolver: each class is a type
and each variable must be declared !
LinearEquationSolver ll = new LinearEquationSolver(a,b);
The right side makes two thing:
•allocate in the memory (in the heap) of the computer the space for an object of
type LinearEquationSolver
•Trough the arguments a and b provides also the parameters to build a
particular type of LinearEquationSolver (and actually solves it)
R. Rigon
Code use
Wednesday, September 4, 13
23. The stack and the heap
Difference between stack and heap memory is common programming
question asked by beginners learning Java or any other programming
language. Stack and heap memory are two terms programmers starts
hearing once they started programming but without any clear and
definite explanation. Lack of knowledge on what is heap in Java and
what is stack memory in Java, results in misconcepts related to stack
and heap. To add to this confusion, stack is also a data structure which
is used to store elements in LIFO(Last In First out) order and available in
Java API as java.util.Stack.
R. Rigon
Java
Wednesday, September 4, 13
24. The stack and the heap
The JVM divided the memory into following sections.
1. Heap
2. Stack
3. Code
4. Static
This division of memory is required for its effective
management.
R. Rigon
Java
Wednesday, September 4, 13
25. 1. The code section contains your bytecode.
2. The Stack section of memory contains methods, local variables and
reference variables.
3. The Heap section contains Objects (may also contain reference
variables).
4. The Static section contains Static data/methods.
Of all of the above 4 sections, you need to understand the allocation of
memory in Stack & Heap the most, since it will affect your programming
efforts
To know more:
http://stackoverflow.com/questions/3646632/does-the-java-primitives-go-on-the-stack-or-the-heap
R. Rigon
Java
Wednesday, September 4, 13
26. public static void main(String[] args){
double a =3,b=4,sol;
System.out.println("nThis is the LinearEquationSolver
main( )n");
LinearEquationSolver ll = new LinearEquationSolver(a,b);
sol=ll.getSolution();
System.out.println("The solution of "+a+" x + "+b+"
== 0 is: x = "+sol);
System.out.println("nEnd of Computationn");
}
A look to the main( ):
This command makes access the solution (otherwise private of the class).
Sometimes this kind of method is called “a getter”.
R. Rigon
Code inspection
Wednesday, September 4, 13
27. public static void main(String[] args){
double a =3,b=4,sol;
System.out.println("nThis is the LinearEquationSolver
main( )n");
LinearEquationSolver ll = new LinearEquationSolver(a,b);
sol=ll.getSolution();
System.out.println("The solution of "+a+" x + "+b+"
== 0 is: x = "+sol);
System.out.println("nEnd of Computationn");
}
A look to the main( ):
This command (a call to a method of a class) print to the video (to the system
console actually) the result.
R. Rigon
Code inspection
Wednesday, September 4, 13
28. A look to LinearEquationSolver method:
public LinearEquationSolver(double a, double b){
if(a !=0){
sol = -b/a;
} else{
throw new RuntimeException("nA solution
does not existsn");
}
}
By default a constructor is package visible, this makes it visible even outside the
package
R. Rigon
Code inspection
Wednesday, September 4, 13
29. public LinearEquationSolver(double a, double b){
if(a !=0){
sol = -b/a;
} else{
throw new RuntimeException("nA solution
does not existsn");
}
}
A look to LinearEquationSolver method:
This is a classic if( ){ }else { } statement. If the argument is true the
statements among the first braces is executed, otherwise the second
R. Rigon
Code inspection
Wednesday, September 4, 13
30. public LinearEquationSolver(double a, double b){
if(a !=0){
sol = -b/a;
} else{
throw new RuntimeException("nA solution
does not existsn");
}
}
A look to LinearEquationSolver method:
This is the solution. Please notice that he solution is assigned to the variable sol, a
static one, which is visible to the whole class (and does not need to be defined
here)
R. Rigon
Code inspection
Wednesday, September 4, 13
31. public LinearEquationSolver(double a, double b){
if(a !=0){
sol = -b/a;
} else{
throw new RuntimeException("nA solution
does not existsn");
}
}
A look to LinearEquationSolver method:
If a is not 0 (that’s the meaning of the argument of a !=0, then an error message is
issued. Java has a built-in strategy to treat errors, and in its jargon it is said that an
error is thrown.
R. Rigon
Code inspection
Wednesday, September 4, 13
32. Throw an error
Well, one can realize that if both a=0 and b=0, the equation is an identity.
So the try ... catch statement should be changed as follows:
if(a !=0){
sol = -b/a;
} else if(b !=0) {
throw new RuntimeException("nA solution does not exists because a =0n");
}else {
throw new RuntimeException("nThis is the trivial identity 0=0n");
}
R. Rigon
Java
Wednesday, September 4, 13
33. A look to LinearEquationSolver method:
R. Rigon
Wednesday, September 4, 13
34. public double getSolution(){
if(Double.isNaN(sol)) {
throw new RuntimeException("nlinearequationSolver
not initializedn");
}else{
return sol;
}
}
A look to getSolution( ) method:
A longer story here: Double is actually a class-wrapper of the primitive type
double and the argument test if sol is a NaN (this construct is necessary, the ==
equality cannot be used here). Actually this fact could never happen here, because
the constructor (which is mandatory) initialize it.
R. Rigon
Code inspection
Wednesday, September 4, 13
35. public double getSolution(){
if(Double.isNaN(sol)) {
throw new RuntimeException("nlinearequationSolver
not initializedn");
}else{
return sol;
}
}
A look to getSolution( ) method:
This is the exception thrown if sol would be a NaN. (I initialized it to a NaN in the
main body of the class).
Code inspection
Wednesday, September 4, 13
36. public double getSolution(){
if(Double.isNaN(sol)) {
throw new RuntimeException("nlinearequationSolver
not initializedn");
}else{
return sol;
}
}
A look to getSolution( ) method:
The return keyword allow to return the solution sol which is passed over to a
double variable which must be catched when the getSolution( ) is used (see
the main( ) )
R. Rigon
Code inspection
Wednesday, September 4, 13
37. public static void main(String[] args){
double a =3,b=4,sol;
....... Omitted code ....
System.out.println("nNow testing the try ... catch ");
a=0;
try{
LinearEquationSolver ll1 = new LinearEquationSolver(a,b);
sol=ll1.getSolution();
System.out.println("The solution of "+a+" x + "+b+" == 0 is: x = "+sol);
}
catch(RuntimeException e){
TextIO.put(e);
}
System.out.println("nEnd of Computationn");
}
A better main( )
This code has been added to test the try-catch statement
R. Rigon
Code inspection
Wednesday, September 4, 13
38. public static void main(String[] args){
double a =3,b=4,sol;
....... Omitted code ....
System.out.println("nNow testing the try ... catch ");
a=0;
try{
LinearEquationSolver ll1 = new LinearEquationSolver(a,b);
sol=ll1.getSolution();
System.out.println("The solution of "+a+" x + "+b+" == 0 is: x = "+sol);
}
catch(RuntimeException e){
TextIO.put(e);
}
System.out.println("nEnd of Computationn");
}
A better main( )
Not very much of a treatment indeed. Just telling that the solution does not exists
if a =0
R. Rigon
Code inspection
Wednesday, September 4, 13
39. How could we have implemented the
getSolution( ) better
R. Rigon
Questions ?
Wednesday, September 4, 13
40. Summary
We have solved a linear equation. The steps trough which we passed
were:
•The analysis of the mathematical problem
•The decision of splitting the problem into 2 classes
In implementing the second class, we adopted a pattern, which is a
particular way for doing it, that experienced OO-programmer think to
be solid and robust. In particular we used a constructor method for
solving the equation, and a getter method for getting the solution,
otherwise hidden to rest of the world.
R. Rigon
To sum up
Wednesday, September 4, 13
41. UML 2.0 representation of the class
LinearEquationSolver
- a: double
- b: double
+LinearEquationSolver ( )
+getSolution ( )
- sol: double
The class we used for the algorithm is represented in the above figure. On
top goes the name of the class. In the center of the body there are the
variables used. On the bottom part the methods of the class. This way of
representing the graphically the class is called class diagram in UML 2.0
(http://www.youtube.com/watch?v=3cmzqZzwNDM)
This is the name of the class
These are the fields of the class
These are the methods of the class
UML
Wednesday, September 4, 13
42. UML 2.0 representation of the class
LinearEquationSolver
+LinearEquationSolver (a:double, b:double)
+getSolution ( ): double
The class we used for the algorithm is represented in the above figure. On
top goes the name of the class. In the center of the body there are the
variables used. On the bottom part the methods of the class. This way of
representing the graphically the class is called class diagram in UML 2.0
(http://www.youtube.com/watch?v=3cmzqZzwNDM)
•The minuses say that the field
are private;
•a “+” would indicate a public
class;
•a “#” a protected class
- a: double
- b: double
- sol: double
R. Rigon
UML
Wednesday, September 4, 13
43. Getting the parameters from the standard input
It seems a secondary task ... but one would not to hard-coding the
parameters inside the class.
We want the program asking for it and we want to insert them at run
time.
We can think to defer to a class the
IO. Thus, we can simply implement
the class, test it and use inside the
general program.
GetTwoDoubleParameters
-a: double
-b: double
+setParameter(): void
R. Rigon
UML
Wednesday, September 4, 13
44. Thank you for your attention.
G.Ulrici,2000?
It ends here
Wednesday, September 4, 13