Showing posts with label Core Java. Show all posts
Showing posts with label Core Java. Show all posts

Sunday, July 9, 2023

Java (JVM) Memory Model - Switches

 

VM SwitchVM Switch Description
-XmsFor setting the initial heap size when JVM starts
-XmxFor setting the maximum heap size.
-XmnFor setting the size of the Young Generation, rest of the space goes for Old Generation.
-XX:PermGenFor setting the initial size of the Permanent Generation memory
-XX:MaxPermGenFor setting the maximum size of Perm Gen
-XX:SurvivorRatioFor providing ratio of Eden space and Survivor Space, for example if Young Generation size is 10m and VM switch is -XX:SurvivorRatio=2 then 5m will be reserved for Eden Space and 2.5m each for both the Survivor spaces. The default value is 8.
-XX:NewRatioFor providing ratio of old/new generation sizes. The default value is 2.

Saturday, June 15, 2019

What is Java

Welcome to the world of Java Programming

What is Java?

Java is programming language and platform first released in 1995.


Java is one of the most widely used and robust programmings language. You can find it everywhere. Let us start our journey with JAVA.


This section describes Java. There is an interesting History behind the evolution of Java language. Be with us. You are entering in a beautiful world of programming.




   This is the First Example of Java. Just to show you the Simple class structure of Java.
    This class is just printing Hello World.


 These are the different application of Java.
 You can see here that Java is in every area. 
 So You can understand its importance better.



    Below are different applications of java. Java is used to build different kinds of applications.
    Each of the below applications described in the subsequent sections.


     Have you seen some Java Desktop Applications?.
     For Example, you make some simple calculator in java and run in your desktop.
     Desktop applications do not require browser help.


  Web Applications running on the server. For Example the HSBC, HDFC bank site.
 


 



  These are different Java platforms according to the users need.
For Example below link will take you to download the Java Standard Edition JDK 8.
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html



   Now Each one of the editions Described with the help of examples.

Here Java SE contains the core java libraries.You can say these are the core Java libraries.



    After the core Java, you need to build Web Applications. For this you need Java EE which includes JSP,Servlet etc. By using these you can create best applications.



   Thank you for being with us. Visit for other sections of Java also.





Tuesday, June 11, 2019

JDK,JRE AND JVM

 JDK, JRE and JVM.


JRE and JDK

Oracle provides two principal software products in the Java™ Platform, Standard Edition (Java™ SE) family:

Java SE Runtime Environment (JRE)

The JRE provides the libraries, Java virtual machine, and other components necessary for you to run applets and applications written in the Java programming language. This runtime environment can be redistributed with applications to make them free-standing.

Java SE Development Kit (JDK)

The JDK includes the JRE plus command-line development tools such as compilers and debuggers that are necessary or useful for developing applets and applications.

Java Programming Language

The Java Programming Language is a general-purpose, concurrent, strongly typed, class-based object-oriented language. It is normally compiled to the bytecode instruction set and binary format defined in the Java Virtual Machine Specification. For more information see Language Features.

Java Virtual Machines


The Java virtual machine is an abstract computing machine that has an instruction set and manipulates memory at run time. The Java virtual machine is ported to different platforms to provide hardware- and operating system-independence.
The Java Platform, Standard Edition provides two implementations of the Java virtual machine (VM):

Java HotSpot Client VM

The client VM is an implementation for platforms typically used for client applications. The client VM is tuned for reducing start-up time and memory footprint. It can be invoked by using the -clientcommand-line option when launching an application.

Java HotSpot Server VM

The server VM is an implementation designed for maximum program execution speed, trading off launch time and memory. It can be invoked by using the -server command-line option when launching an application.
For more information, see the VM documentation.

 JDK, JRE and JVM Presentation

Monday, June 10, 2019

How to Set Environment Variables in Java

Set Environment Variables in Java



Windows 10 and Windows 8

  1. In Search, search for and then select: System (Control Panel)
  2. Click the Advanced system settings link.
  3. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
  4. In the Edit System Variable (or New System Variable) window, specify the value of the PATHenvironment variable. Click OK. Close all remaining windows by clicking OK.
  5. Reopen Command prompt window, and run your java code.

Presentation:


Java History

History of Java.

Welcome to know about the History of Java.

In this section, you will know about the main faces behind the evolution of Java and Why they named it Java.


Java was started as a project called "Oak" by James Gosling in June 1991.

Gosling's goals were to implement a virtual machine and a language that had a familiar C-like
notation but with greater uniformity and simplicity than C/C++. 
The first public implementation was Java 1.0 in 1995. 
It made the promise of "Write Once, Run Anywhere", with free runtimes on popular platforms. It was fairly secure and its security was configurable, allowing for network and file access to be limited. 


Friday, May 31, 2019

operators in java

Java Operators

Operators

Now that you've learned how to declare and initialize variables, you probably want to know how to do something with them. Learning the operators of the Java programming language is a good place to start. Operators are special symbols that perform specific operations on one, two, or three operands, and then return a result.

As we explore the operators of the Java programming language, it may be helpful for you to know ahead of time which operators have the highest precedence. The operators in the following table are listed according to precedence order. The closer to the top of the table an operator appears, the higher its precedence. Operators with higher precedence are evaluated before operators with relatively lower precedence. Operators on the same line have equal precedence. When operators of equal precedence appear in the same expression, a rule must govern which is evaluated first. All binary operators except for the assignment operators are evaluated from left to right; assignment operators are evaluated right to left.


Operator Precedence
OperatorsPrecedence
postfixexpr++ expr--
unary++expr --expr +expr -expr ~ !
multiplicative* / %
additive+ -
shift<< >> >>>
relational< > <= >= instanceof
equality== !=
bitwise AND&
bitwise exclusive OR^
bitwise inclusive OR|
logical AND&&
logical OR||
ternary? :
assignment= += -= *= /= %= &= ^= |= <<= >>= >>>=


The Arithmetic Operators

The Java programming language provides operators that perform addition, subtraction, multiplication, and division. There's a good chance you'll recognize them by their counterparts in basic mathematics. The only symbol that might look new to you is "%", which divides one operand by another and returns the remainder as its result.
OperatorDescription
+Additive operator (also used for String concatenation)
-Subtraction operator
*Multiplication operator
/Division operator
%Remainder operator


The Unary Operators

The unary operators require only one operand; they perform various operations such as incrementing/decrementing a value by one, negating an expression, or inverting the value of a boolean.
OperatorDescription
+Unary plus operator; indicates positive value (numbers are positive without this, however)
-Unary minus operator; negates an expression
++Increment operator; increments a value by 1
--Decrement operator; decrements a value by 1
!Logical complement operator; inverts the value of a boolean



The Equality and Relational Operators

The equality and relational operators determine if one operand is greater than, less than, equal to, or not equal to another operand. The majority of these operators will probably look familiar to you as well. Keep in mind that you must use "==", not "=", when testing if two primitive values are equal.
==      equal to
!=      not equal to
>       greater than
>=      greater than or equal to
<       less than
<=      less than or equal to


The Conditional Operators

The && and || operators perform Conditional-AND and Conditional-OR operations on two boolean expressions. These operators exhibit "short-circuiting" behavior, which means that the second operand is evaluated only if needed.
&& Conditional-AND
|| Conditional-OR
The following program, ConditionalDemo1, tests these operators:
class ConditionalDemo1 {

    public static void main(String[] args){
        int value1 = 1;
        int value2 = 2;
        if((value1 == 1) && (value2 == 2))
            System.out.println("value1 is 1 AND value2 is 2");
        if((value1 == 1) || (value2 == 1))
            System.out.println("value1 is 1 OR value2 is 1");
    }
}

Another conditional operator is ?:, which can be thought of as shorthand for an if-then-else statement (discussed in the Control Flow Statements section of this lesson). This operator is also known as the ternary operator because it uses three operands. In the following example, this operator should be read as: "If someCondition is true, assign the value of value1 to result. Otherwise, assign the value of value2 to result."
The following program, ConditionalDemo2, tests the ?: operator:
class ConditionalDemo2 {

    public static void main(String[] args){
        int value1 = 1;
        int value2 = 2;
        int result;
        boolean someCondition = true;
        result = someCondition ? value1 : value2;

        System.out.println(result);
    }
}

Because someCondition is true, this program prints "1" to the screen. Use the ?: operator instead of an if-then-else statement if it makes your code more readable; for example, when the expressions are compact and without side-effects (such as assignments).












Create a Digital Clock using HTML and JavaScript

Create a Digital Clock using HTML and JavaScript  <! DOCTYPE html> < html > < head > <...

Followers

Search This Blog

Popular Posts