Friday 23 March 2018

Comment line in java

Comments allow us to place any form of documentation inside our Java code. They can
contain anything that we can type on the keyboard: English, mathematics, even lowresolution
pictures. In general, Java recognizes comments as tokens, but then excludes
these tokens from further processing; technically, it treats them as white space when it is
forming tokens.
Comments help us capture aspects of our programs that cannot be expressed as Java
code. Things like goals, specification, design structures, time/space tradeoffs, historical
information, advice for using/modifying this code, etc. Programmers intensely study their
own code (or the code of others) when maintaining it (testing, debugging or modifying
it). Good comments in code make all these tasks much easier.
Java includes two styles for comments.
(1) Line-Oriented:- begins with // and continues until the end of the line.
(2) Block-Oriented:- begins with /* and continues (possibly over many lines) until */
is reached.
o So, we can use block-oriented comments to create multiple comments within a
line
display (/*Value*/ x, /*on device*/ d);
In contrast, once a line-oriented comment starts, everything afterward on its
line is included in the comment.
We can also use block-oriented comments to span multiple lines
/*
this is a multi-line comment.
No matter home many lines
it includes, only one pair
of delimiters are needed
*/

Tokens

In a Java program, all characters are grouped into symbols called tokens.
Java language features are built from the first five categories of tokens.
(a) Keyword
(b) Identifier
(c) Literal / constant
(d) Operator
(e) Punctual latter / Separator

(a) Keyword:

Keywords are the reserved words for a language, which express the language
features. Keywords cannot be used to name variables, constants, or classes. Java is a casesensitive
language and the keywords should be written in lowercase only. The keywords with
all or some letters in uppercase can be treated as a variable name but that should be avoided.
Listed java keywords.
Finally, assert was recently added (in Java 1.4) to the original 48 keywords in Java.

(b) Identifier:  

Identifiers are used by programmers to name things in Java: - things such as
variables, methods, fields, classes, interfaces, exceptions, packages, etc.
Identifiers: - be meaningful and unique
ex:- bsic_sal
amt_ valid
gros_sal
(1) It is combination of alphabets, digits or underscore (_).it means digits cannot be used
of identifiers
ex:- salary
balary valid
Basic _salary
5.year invalid
Ex:-basic_Sal
Amt gross_Sal
Interest _sxear
(2) First character of identifier most be an alphabet or under _score (_).it minus digits
Character of identifier
ex :- salary valid
basic_salary
(3) Number special symbols can be used except (_) underscore
ex:-basic_sal
principal_sal valid
loan& salary invalid
my*salry
(4) No keyword: - are used as identifier
ex:- int
float invalid identifier
double
(5) Identifier: - doesn’t contain any white space
Ex:-basic sal invalid
Price amt
Pascal basic_sal valid
Prince _amt prince_amt
(6) Identifier:-can have maximum 31 or 32 character is signification
Ex:-Student roll errors both are some
Student marks

(c) Literal / constant: 

Literals are the values to be stored in variables and constants. A literal
contains a sequence of characters, such as digits, alphabets, or any other symbol that
represents the value to be stored. The various types of literals in Java.
Two types of literal/ constant in java
(a) Numeric
(1) integer-literal
(2) floating-point-literal
(3) Boolean-literal
(b) Non_ Numeric

(a) Numeric literal: - 

it is a work on number or numeric values.

(1) Integer-literal:- 

Are numeric type values. The numerical values can be represented
in octal and hexadecimal notation. The octal notation of a number is prefixed by
zero and hexadecimal numbers are prefixed by 0x.
For example, n=0123is integer literal in
octal notation, n=0x456 is integer literal in hexadecimal notation,
and n=2is decimal notation for an integer literal.
non-zero-digit = 1|2|3|4|5|6|7|8|9
digit = 0 | non-zero-digit
digits = digit{digit}
decimal-numeral = 0 | non-zero-digit[digits]
integer-literal = decimal-numeral
octal-numeral
hexadecimal-numeral
(1) character-literal
(2) string-literal
(3) null-literal
(2) Floating-point-literal:- Are numeric values with fractional part. For example,
x=7.9is a floating point literal.
Exponent-indicator = e | E
exponent-part = exponent-indicator [+|-] digits
floating-point-literal = digits exponent-part
digits.[digits] [exponent-part]
.digits[exponent-part]
...........................................................................................................................................................
(3) Boolean-literal: - Are the literals having value, true or false. For example,
x=false is a boolean literal.
Literals of the primitive type Boolean represent on/off, yes/no, present/absent
data. There are only two values of this primitive type, so its ENBF rule is trivially
written as
Boolean-literal = true | false
…………………………………………………………………………………………………………
(b) Non_ Numeric:- A literal /constant which is related two charter is called non numeric
Constant .it is of two type.
(1) Character-literal: - Are represented in single quotation marks.
For example, x=‘k’| 'graphic' | 'space' | 'escape-sequence' is a character literal.
(2) String-literal: - Are enclosed in double quotation marks. For example, x="James”
|”niraj kumar Sharma”| "{graphic | space | escape-sequence}" is a string
literal.

JAVA PROGRAMMING

How to set path in java programming

Setep1:-- install java application in host machine
Step2:-- Open my computer and go C drive chose all program chose java bin copy
(ctrl+c) path
Step3:- my computer right click goto his properties select advance system seting ok.
Go envorment variables chose new paste selected path jdk/bin (ctrl+v)
%path%; C:\Program Files\Java\jdk1.6.0\bin;.
Step4:-- open command prompt (windows+r type (cmd))
Step5:-- dir java Step6:- open notpad type source code save (niraj.java)
Step7: compile (javac niraj.java) run program (java niraj)

Type casting conversion

It is a concept use in almost all language to assign the value of one type into another type. Java
also supports such future to convert / type cast one type of value into another type of value.

It convert data from one type to another type is also known as type casting conversion.
Two type of type casting in java.

(1) Implicit conversion
(2) Explicit conversion

(1) Implicit Conversion

Implicit conversion refers to an automatic conversion of one data type to another. It
occurs if both the data types are compatible with each other.
For example, you can assign a value of int type to a variable of long data type.
class implicitc
{
                   public static void main(String... args)
                 {
                         int n=100;
                         System.out.println(n);
                         long m=n;
                        System.out.println(m);
                       double p=m;
                       System.out.println(p);
                  }
}

(2) Explicit Conversion

Explicit conversion occurs when one data type cannot be implicitly converted to another
data type. In an explicit conversion, you must convert the data type to the compatible
type.
For example, the int type is large enough to store a byte value. Therefore, it does
not require any explicit conversion. However, assigning an int value to a byte type
would require explicit conversion as the range of the byte type is smaller as compared
to the int type
 You can use the following code to perform type casting of an int number, 259and
a double number, 350.55to byte type:
class TypeCast
{
              public static void main(String arr [])
             {
                   byte b;
                     int i = 259;
                    double d = 350.55;
                    b = (byte) i;
                    System.out.println("Value of int to byte conversion" + b);
                    b = (byte) d;
                        System.out.println("Value of double to byte conversion" + b);
                       i = (int) d;
                     System.out.println("Value of double to int conversion" + i);
                }
}
एक चूहा एक कसाई के घर में बिल बना कर रहता था।

एक दिन चूहे ने देखा कि उस कसाई और उसकी पत्नी एक थैले से कुछ निकाल रहे हैं। चूहे ने सोचा कि शायद कुछ खाने का सामान है।

उत्सुकतावश देखने पर उसने पाया कि वो एक चूहेदानी थी।

ख़तरा भाँपने पर उस ने पिछवाड़े में जा कर कबूतर को यह बात बताई कि घर में चूहेदानी आ गयी है।

कबूतर ने मज़ाक उड़ाते हुए कहा कि मुझे क्या? मुझे कौनसा उस में फँसना है?

निराश चूहा ये बात मुर्गे को बताने गया।

मुर्गे ने खिल्ली उड़ाते हुए कहा… जा भाई.. ये मेरी समस्या नहीं है।

हताश चूहे ने बाड़े में जा कर बकरे को ये बात बताई… और बकरा हँसते हँसते लोटपोट होने लगा।

उसी रात चूहेदानी में खटाक की आवाज़ हुई,  जिस में एक ज़हरीला साँप फँस गया था।

अँधेरे में उसकी पूँछ को चूहा समझ कर उस कसाई की पत्नी ने उसे निकाला और साँप ने उसे डस लिया।

तबीयत बिगड़ने पर उस व्यक्ति ने हकीम को बुलवाया। हकीम ने उसे कबूतर का सूप पिलाने की सलाह दी।

कबूतर अब पतीले में उबल रहा था।

खबर सुनकर उस कसाई के कई रिश्तेदार मिलने आ पहुँचे जिनके भोजन प्रबंध हेतु अगले दिन उसी मुर्गे को काटा गया।

कुछ दिनों बाद उस कसाई की पत्नी सही हो गयी, तो खुशी में उस व्यक्ति ने कुछ अपने शुभचिंतकों के लिए एक दावत रखी तो बकरे को काटा गया।

चूहा अब दूर जा चुका था, बहुत दूर ……….।

अगली बार कोई आपको अपनी समस्या बतायेे और आप को लगे कि ये मेरी समस्या नहीं है, तो रुकिए और दुबारा सोचिये।

समाज का एक अंग, एक तबका, एक नागरिक खतरे में है तो पूरा देश खतरे में है।

अपने-अपने दायरे से बाहर निकलिये। स्वयं तक सीमित मत रहिये। सामाजिक बनिये.."

NIRAJ KUMAR



Mobile                         -             +91 8252281522   
Email     - sharma.nirajkumar@ymail.com
Email     - sharma.nirajkumar82@gmail.com

My Educational Qualification

MCA(MASTER OF COMPUTER APPLICATION)
BCA(BACHELOR OF COMPUTER APPLICATION) 
I  have 2yr Experience on JAVA(Netbeans) J2EE(Eclipse) and Web site development on HTML CSS and Java Server Pages (JSP) and Oracle And Mysql