Jay Kakadiya

I am a computer field, & i am Web developer.

Student at DA degree engineering

Studied at Bhavna higher and secondary school

Certified in HTML , C, C++ , CSS, Java script, Bootstrap, php, WordPress

Java Identifiers

Java IdentifiersAll Java variables must be identified with unique names.These unique names are called identifiers.Identifiers can be short names (like x and y) or more descriptive names (age, sum, totalVolume).Note: It is recommended to use descriptive names in order to create understandable and maintainable code.The general rules for constructing names for variables (unique identifiers) are:Names can contain letters, digits, underscores, and dollar signsNames must begin with a letterNames should start with a lowercase letter and it cannot contain whitespaceNames can also begin with $ and _ (but we will not use it in this tutorial)Names are case sensitive ("myVar" and "myvar" are different variables)Reserved words (like Java keywords, such as int or String) cannot be used as namesTest Yourself With ExercisesExercise:Create a variable named carName and assign the value Volvo to it. = ;

Java Quickstart 2

Don't worry if you don't understand the code above - we will discuss it in detail in later chapters. For now, focus on how to run the code above.Save the code in Notepad as "MyClass.java". Open Command Prompt (cmd.exe), navigate to the directory where you saved your file, and type "javac MyClass.java":C:\Users\Your Name>javac MyClass.javaThis will compile your code. If there are no errors in the code, the command prompt will take you to the next line. Now, type "java MyClass" to run the file:C:\Users\Your Name>java MyClassThe output should read:Hello Worldpublic class MyClass { public static void main(String[] args) { System.out.println("Hello World"); } } Output.C:\Users\Name\java MyClassHello World

Floating Point Types

Floating Point TypesYou should use a floating point type whenever you need a number with a decimal, such as 9.99 or 3.14515.FloatThe float data type can store fractional numbers from 3.4e−038 to 3.4e+038. Note that you should end the value with an "f":Examplefloat myNum = 5.75f; System.out.println(myNum); DoubleThe double data type can store fractional numbers from 1.7e−308 to 1.7e+308. Note that you should end the value with a "d":Exampledouble myNum = 19.99d; System.out.println(myNum); Use float or double?The precision of a floating point value indicates how many digits the value can have after the decimal point. The precision of float is only six or seven decimal digits, while double variables have a precision of about 15 digits. Therefore it is safer to use double for most calculations.

Scientific Numbers in java

Scientific Numbers in javaA floating point number can also be a scientific number with an "e" to indicate the power of 10:Examplefloat f1 = 35e3f; double d1 = 12E4d; System.out.println(f1); System.out.println(d1); BooleansA boolean data type is declared with the boolean keyword and can only take the values true or false:Exampleboolean isJavaFun = true; boolean isFishTasty = false; System.out.println(isJavaFun); // Outputs true System.out.println(isFishTasty); // Outputs false Boolean values are mostly used for conditional testing, which you will learn more about in a later chapter.CharactersThe char data type is used to store a single character. The character must be surrounded by single quotes, like 'A' or 'c':Examplechar myGrade = 'B'; System.out.println(myGrade); Alternatively, you can use ASCII values to display certain characters:Examplechar a = 65, b = 66, c = 67; System.out.println(a); System.out.println(b); System.out.println(c); Tip: A list of all ASCII values can be found in our ASCII Table Reference.StringsThe String data type is used to store a sequence of characters (text). String values must be surrounded by double quotes:ExampleString greeting = "Hello World"; System.out.println(greeting); The String type is so much used and integrated in Java, that some call it "the special ninth type".A String in Java is actually a non-primitive data type, because it refers to an object. The String object has methods that is used to perform certain operations on strings. Don't worry if you don't understand the term "object" just yet. We will learn more about strings and objects in a later chapter.Non-Primitive Data TypesNon-primitive data types are called reference types because they refer to objects.The main difference between primitive and non-primitive data types are:Primitive types are predefined (already defined) in Java. Non-primitive types are created by the programmer and is not defined by Java (except forString).Non-primitive types can be used to call methods to perform certain operations, while primitive types cannot.A primitive type has always a value, while non-primitive types can be null.A primitive type starts with a lowercase letter, while non-primitive types starts with an uppercase letter.The size of a primitive type depends on the data type, while non-primitive types have all the same size.Examples of non-primitive types are Strings, Arrays, Classes, Interface, etc. You will learn more about these in a later chapter.Test Yourself With ExercisesExercise:Add the correct data type for the following variables: myNum = 9; myFloatNum = 8.99f; myLetter = 'A'; myBool = false; myText = "Hello World";

What is Java?

Java is a popular programming language, created in 1995.It is owned by Oracle, and more than 3 billion devices run Java.It is used for:Mobile applications (specially Android apps)Desktop applicationsWeb applicationsWeb servers and application serversGamesDatabase connectionAnd much, much more!

Java Quickstart

Java QuickstartIn Java, every application begins with a class name, and that class must match the filename.Let's create our first Java file, called MyClass.java, which can be done in any text editor (like Notepad).The file should contain a "Hello World" message, which is written with the following code:MyClass.javapublic class MyClass { public static void main(String[] args) { System.out.println("Hello World"); } }

Python Exercises

Python ExercisesExercise:Insert the missing part of the code below to output "Hello World".("Hello World")

What is Python?

What is Python?Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.It is used for:web development (server-side),software development,mathematics,system scripting.What can Python do?Python can be used on a server to create web applications.Python can be used alongside software to create workflows.Python can connect to database systems. It can also read and modify files.Python can be used to handle big data and perform complex mathematics.Python can be used for rapid prototyping, or for production-ready software development.

Why Python?

Why Python?Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).Python has a simple syntax similar to the English language.Python has syntax that allows developers to write programs with fewer lines than some other programming languages.Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.Python can be treated in a procedural way, an object-orientated way or a functional way.Good to knowThe most recent major version of Python is Python 3, which we shall be using in this tutorial. However, Python 2, although not being updated with anything other than security updates, is still quite popular.In this tutorial Python will be written in a text editor. It is possible to write Python in an Integrated Development Environment, such as Thonny, Pycharm, Netbeans or Eclipse which are particularly useful when managing larger collections of Python files.Python Syntax compared to other programming languagesPython was designed for readability, and has some similarities to the English language with influence from mathematics.Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose.

Python Getting Started

Python Getting StartedPython InstallMany PCs and Macs will have python already installed.To check if you have python installed on a Windows PC, search in the start bar for Python or run the following on the Command Line (cmd.exe):C:\Users\Your Name>python --versionTo check if you have python installed on a Linux or Mac, then on linux open the command line or on Mac open the Terminal and type:python --version

JavaScript Number Methods

JavaScript Number MethodsNumber methods help you work with numbers.Number Methods and PropertiesPrimitive values (like 3.14 or 2014), cannot have properties and methods (because they are not objects).But with JavaScript, methods and properties are also available to primitive values, because JavaScript treats primitive values as objects when executing methods and properties.The toString() MethodThe toString() method returns a number as a string.All number methods can be used on any type of numbers (literals, variables, or expressions):Examplevar x = 123;x.toString();            // returns 123 from variable x(123).toString();       // returns 123 from literal 123(100 + 23).toString();   // returns 123 from expression 100 + 23

The toExponential() Method

The toExponential() MethodtoExponential() returns a string, with a number rounded and written using exponential notation.A parameter defines the number of characters behind the decimal point:Examplevar x = 9.656;x.toExponential(2);     // returns 9.66e+0x.toExponential(4);     // returns 9.6560e+0x.toExponential(6);     // returns 9.656000e+0The parameter is optional. If you don't specify it, JavaScript will not round the number.The toFixed() MethodtoFixed() returns a string, with the number written with a specified number of decimals:Examplevar x = 9.656;x.toFixed(0);           // returns 10x.toFixed(2);           // returns 9.66x.toFixed(4);           // returns 9.6560x.toFixed(6);           // returns 9.656000toFixed(2) is perfect for working with money.The toPrecision() MethodtoPrecision() returns a string, with a number written with a specified length:Examplevar x = 9.656;x.toPrecision();        // returns 9.656x.toPrecision(2);       // returns 9.7x.toPrecision(4);       // returns 9.656x.toPrecision(6);       // returns 9.65600