Static Members Flow Class members In java application we are defining objects for communication.Every Object is represented as a model(class). Hence, java application is the combination of classes. And every class in java application is allowed to define following members. 1) static members 2) non-static members Static members flow using JVM architecture : Java class supports definition of 4 static members. 1) static main method 2) static block 3) static variable 4) static method Static main method Example class Demo { //empty..... } How to Compile & Execute a simple Java program? 1) Save the program in "d-drive" with name Demo.java 2) Open command prompt, navigate to the path where the java program is stored 3) Compilation: cmd/> javac Demo.java Demo.class file will be generated. 4) Execution: cmd/>java Demo Error : main method not found... main method : 1) It is static method, hence...
Why Collections & why is it called a Framework? First Question: Why Collections? Collections are used to overcome problems with variables, arrays, classes like size problem, type problem, non existence of predefined operations/methods, etc. To get a Overview of the above discussed problems, click on this link What is a Framework? Its a semi-finished re-usable application, providing some low level services, which can be customized according to our requirement. Second Question: Why is it called a Framework? Collection API is available in util package & its called a Framework for the reason that, java programmers were not restricted to just utilize the existing classes making them final but was allowed to expand on top of the exiting classes inheriting them. Collections framework gives a clear example of when to use Interface & abstract class Classification of Collection Framework: In Collection Framework all the classes are classified into 3 cat...
Typical Steps involved in Creating Log4j Configuration file Configure the root logger - What to Log - info/debug/error/fatal messages Configure individual loggers (if needed). Specify appenders -- Where to Log -- in File/Console, etc Specify message layout/Pattern -- How to Log - format to log the message Configuring a Layout PatternLayout lets you determine how data is extracted from log events and formatted for output based on a conversion pattern. Conversion patterns act as placeholders for data that appears in each log event. For example, let’s break down a PatternLayout commonly used in Log4j: <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> %d{HH:mm:ss.SSS} formats the date in terms of hours, minutes, seconds, and milliseconds. %t displays the Logger’s current thread. %level displays the severity of the log event. %logger displays the name of the Logger. %m displays the event’s message. Finally, %n adds a new line for the next e...
Comments
Post a Comment