Skip to main content

Posts

Showing posts from July, 2021

Enhancing Indoor Air Quality: A Guide to Better Health and Comfort

In today's world, where we spend a significant amount of our time indoors, the quality of the air we breathe inside our homes and workplaces is crucial for our health and well-being. Poor indoor air quality (IAQ) can lead to various health issues, including allergies, respiratory problems, and even long-term conditions. This blog post explores effective strategies for managing and improving indoor air quality. Understanding Indoor Air Pollutants Indoor air pollutants can originate from various sources: Biological Pollutants: Mold, dust mites, and pet dander. Chemical Pollutants: Volatile organic compounds (VOCs) from paints, cleaners, and furnishings. Particulate Matter: Dust, pollen, and smoke particles. Strategies for Improving Indoor Air Quality Ventilation: Natural Ventilation: Open windows and doors regularly to allow fresh air circulation. Mechanical Ventilation: Use exhaust fans in kitchens and bathrooms to remove pollutants directly at the source. Air Purifiers: HEPA Filt

Java important question - 4

1) What is anonymous inner class ?           A local inner class without name is known as anonymous inner class. An anonymous class is defined and instantiated in a single statement. Anonymous inner class always extend a class or implement an interface.           Since an anonymous class has no name, it is not possible to define a constructor for an anonymous class. Anonymous inner classes are accessible only at the point where it is defined. 2) What is the difference between == and .equals() method in Java?           In general both equals() and "==" operator in java are used to compare objects to check equality but here are some of the difference between the two: 1) Main difference between . equals() method and == operator is that one is method and other is operator. 2) We can use == operators for reference comparison and .equals() method for content comparison. In simple words, == checks if both objects point to the same memory location whereas . equals() evaluates to the

Java Important questions - 3

1) Name the methods of Object class? clone() - This method helps to create and return a copy of the object. equals() - This method helps to compare. finalize () - called by the garbage collector on an object. getclass() - It helps to return the runtime class of an object. hashcode() - Helps to return a hash code value for the object toString() - helps to return a string representation of the object. notify(), notifyAll() and wait() - It helps to synchronize the activities of independently running threads in a program. 2) What are constructors in java? What are the types of constructors?           In java, the constructor is a block of code used to initialize an object. The constructor is a method which has the same name as class name. There are two types of constructors: 1. Default constructor :           A constructor that has no parameters is known as default constructor. If we don't define a constructor in a class, the compiler creates a default constructor for the class.

Class in java

Define class in Java           In java, a class is a template used to create object and define the data type. It acts as a building block for java language oriented systems. All java codes are defined in a class. A class has variables and methods.           Variables are attributes which define the state of class.           Methods are the place where the exact business logic has to be done. It contains a set of statements or instructions to satisfy the particular requirement. Eg:  public class Addition // class name declaration { int a= 5; // variable declaration int b= 5;  public void add() { // Method declaration int c=a+b; } } What do you mean by object ?           Object is a basic unit of  Object oriented programming and represents the real life entities. A typical java program creates many objects, which interact each other by invoking methods. A java object is a combination of data and procedures working on the available data. An object has a state and behavior. The state of an

Main method in Java

What is main method in Java?           Main method in Java is an standard method which is used by JVM to start execution of any java program. Main method is referred as entry point of any standalone java application.           Main method in Java is public so that it's visible to every other class, even which are not part of it's package. If it is not public, JVM class might not able to access it.           Main method is static so that java runtime can access it without initializing the class. While JVM tried to execute java program, it doesn't know how to create instance of main class as there is no standard constructor is defined for main class.           Main method is void in Java because it doesn't return anything to caller which is JVM. Signature of main method:           main method is public, static and void and accept an array of String as argument through which we can pass runtime arguments to the java program. From java5 onwards it can also accept variable a

Java Important Questions - 2

1) Does Java uses pointers?          No, java doesn't use Pointers. Carelessness in their use may result in memory problems. Also it has tough security. Instead of Pointers, reference are used in java as they are safer and more secure when compared to a Pointer. 2) How are Destructors defined in java?           Since, java has it's own garbage collection, no destructors are required to be defined. Destruction of objects is automatically carried by the garbage collection mechanism. 3) What is the difference between path and classpath variable?           PATH is an environment variable used by operating system to locate the executables. Once you installed java on your machine, it is required to set the PATH environment variable to run conveniently run the executables (javac.exe, java.exe, javadoc.exe,and so on) from any directory without having to type the full path of the command,such as: c:\javac Testclass.java Otherwise, you need to specify the full path every time you run it,

Difference between JDK, JRE and JVM

Difference between JDK,JRE and JVM           JDK, JRE and JVM are core concepts of java programming language. Although they all look similar and as a programmer we don't care about this concepts a lot, but they are different and meant for specific purpose. JDK           Java development kit is the core component of java environment and provides all the tools, executables and binaries required to compile, debug and execute a java program. JDK is a platform specific software and thats why we have separate installers for Windows, Mac and Unix system. We can say that JDK is superset of JRE. Since it contains JRE with java compiler, debugger and core classes. Current version of JDK is 16 also known as java 16. JVM            JVM is the heart of java programming language. when we run a program, JVM is responsible to converting Byte code to the machine specific code. JVM is also platform dependent and provides core Java functions like memory management, garbage collection, security etc. J

Java Questions and Answers - 1

1) What do you mean by platform independent in java?           Platform independence means that you can run the same java program in any Operating system. For example, you can write java program in window and run it in Mac OS. 2) What is JVM and is it platform independent ?           Java virtual machine (JVM )  is the heart of java programming language. JVM is responsible for converting byte code into machine readable code. JVM is not platform independent, that's why you have different JVM for different operating system. We can customize JVM with java options, such as minimum and maximum memory to JVM. It is called virtual because it provides an interface that doesn't depend on the underlying OS. 3) Java compiler is stored in JDK, JRE or JVM ?           The task of java compiler is to convert java program into byte code, we have javac executeable for that. So it must be stored in JDK, we don't need it in JRE and JVM is just the specs. 4) Which class is the superclass of al