Different ways of reading inputs from keyboard in java… .. .

Getting inputs from end-user is quite crucial task in everywhere.Here i am go to make u aware of various strategies to get input from keyboard.Priorly, Point to be remember below stuff gives you only basic approaches to do the task i.e getting inputs,In addition to these there are many approaches like reading from file etc….are there in-order to get inputs.


Mainly there are 6 approaches,They are

  • Scanner class approach
  • Console class approach
  • InputStreamReader approach
  • Swing 
  • System class 
  • command -line 

sample program illustrates all above approaches:

package p;

import java.io.BufferedReader;
import java.io.Console;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class p12
{
public static void main(String[] args)
{
Scanner scanner=new Scanner(System.in);
System.out.println(“Enter the input”);
String input=scanner.next();
System.out.println(“Scanner-Entered Input is:”+input);

Console console=System.console();
System.out.println(“Enter the input”);
String input2=console.readLine();
System.out.println(“Console-Entered Input is:”+input2);

String input3=null;
System.out.println(“Enter the input”);
InputStreamReader inputStreamReader=new InputStreamReader(System.in);
BufferedReader bufferedReader=new BufferedReader(inputStreamReader);
try
{
input3=bufferedReader.readLine();

}
catch (IOException e)
{

e.printStackTrace();
}

System.out.println(“BufferedReader-Entered Input is:”+input3);

System.out.println(“Enter the input”);
String input4=javax.swing.JOptionPane.showInputDialog(“Enter the text”);
System.out.println(“Swing-Entered Input is:”+input4);

System.out.println(“Enter the input”);
String input5;
input5=System.getProperty(“Steve jobs”);
System.out.println(“System-Entered input is:”+input5);

int input6=Integer.getInteger(“123”);
String input7=String.valueOf(“Madhu”);

}
}

output:

======

Enter the input
Siddarth
Scanner-Entered Input is:Siddarth
Enter the input
Steve
Console-Entered Input is:Steve
Enter the input
Ammu
BufferedReader-Entered Input is:Ammu
Enter the input
Cristiano
Swing-Entered Input is:Madhu
Enter the input:Messi
System-Entered input is:Messi


NOTE:

Console class wont work in ide like eclipse etc.. .

op4

Different Types of shapes printing in java… .. .

For  doing below stuff there’s no need of going into Java 2D graphics et c..advanced topics. U can implement more user Interface attractive shapes by using 2D graphics.

But these stuff is quite useful to crack system test somewhat ,Hope it will assist you … .. .



1. square:
========

package p;

public class p
{
public static void main(String[] args)
{
for(int i=1;i<=4;i++)
{
for(int j=1;j<=4;j++)
{
if((i==2&&(j==2||j==3))||(i==3&&(j==2||j==3)))
{
System.out.print(“\t”);
}
else
{
System.out.print(“*”);
System.out.print(“\t”);}
}
System.out.println(“\n”);
}
}
}
output:
=====

op3

————————–THE_END——————————————


2.Triangle:
=======

code:
—–

package p;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class p3 {
public static void main ( String arg[] ){
InputStreamReader istream = new InputStreamReader(System.in) ;
BufferedReader read = new BufferedReader(istream) ;
System.out.print(“Enter Triangle Size : “);
int num=0;
try{
num=Integer.parseInt( read.readLine() );
} catch(Exception Number){
System.out.println(“Invalid Number!”);
}
for(int i=1;i<=num;i++){
for(int j=1;j<num-(i-1);j++){
System.out.print(” “);
}
for(int k=1;k<=i;k++){
System.out.print(“*”);
for(int k1=1;k1<k;k1+=k){

System.out.print(“*”);
}
}
System.out.println();
}
}
}
output:
——-
Enter Triangle Size : 5
*
***
*****
*******
*********

ii)

code:
====

package p;

public class p5 {

public static void main(String[] args) {
int c=0;
for (int i =1;i<5;i++) {
for (int j =5;j>i;j–) {
System.out.print(” “);
}
for (int j =1; j <=i; j++) {
System.out.print(++c);
}

for (int j =1; j <i; j++) {
System.out.print(–c);
}
System.out.println();
}
}
}

output:
=====

1
232
34543
4567654

iii)

code:
—–
package p;
class p6
{
public static void main(String[] args)
{
//Scanne in = new Scanner(System.in);
int h=10;
// int h=in.nextInt(); //height <- read input
for(int i=0;i<h;i++){
for(int s=1;s<h-i;s++) //spacing
System.out.print(“-“);
for(int j=0;j<=i*2;j++){
if(j==i*2 || j==0)
System.out.print(“X”); //first and last pos
else if(i==h-1)
System.out.print(“X”); //last line
else
System.out.print(“-“); //middle
}
System.out.println(); //new line
}
}
}

output:
——-
———X
——–X-X
——-X—X
——X—–X
—–X——-X
—-X———X
—X———–X
–X————-X
-X—————X
XXXXXXXXXXXXXXXXXXX

iv)

code:
——

package p;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class p8 {
public static void main ( String arg[] ){
InputStreamReader istream = new InputStreamReader(System.in) ;
BufferedReader read = new BufferedReader(istream) ;
System.out.print(“Enter Triangle Size : “);
int num=0;
try{
num=Integer.parseInt( read.readLine() );
} catch(Exception Number){
System.out.println(“Invalid Number!”);
}
for(int i=1;i<=num;i++){
for(int j=1;j<=num-(i-1);j++){
System.out.print(“*”);
if(j==num-(i-1)){
for(int k=1;k<=i;k+=1){
System.out.print(” “);
}
for(int s=1;s<i;s++){
System.out.print(” “);
}
for(int l=1;l<=num-(i-1);l++){
System.out.print(“*”);
}
}
}
System.out.println();
}
}
}
output:
——-

Enter Triangle Size : 7
******* *******
****** ******
***** *****
**** ****
*** ***
** **
* *
v)

code:
—–
package p;
import java.io.BufferedReader;
import java.io.Console;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

class p9
{
int count = 0;
public static void asterisk1(int n)
{
if(n==0)
{
System.out.println();
}
else
{
System.out.print(“*”);
asterisk1(n-1);
}
}
public static void asterisk2( int n)
{
if(n==0){
return; }
else
{
asterisk1(n);
asterisk2(n-1);
}
}
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print(“Please enter size : “);
String no = null;
try
{
no = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(“You entered : ” + no);
int n1=Integer.parseInt(no);
asterisk1(n1);
asterisk2(n1);

}
}
output:
——-

Please enter size : 9
You entered : 9
*********
*********
********
*******
******
*****
****
***
**
*

vi)

code:
====

package p;
import java.util.Scanner;
public class p9
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print(“Enter a number: “);
int n = input.nextInt();
p91 access = new p91();
access.asterisk3(n); access.asterisk2(n);
}
}
class p91
{
private int count = 0;
public static void asterisk1(int n) {
if(n==0) { System.out.println();
} else {
System.out.print(“*”);
asterisk1(n-1);
}
}
public void asterisk2( int n) {
if(n==0) { return;
} else {
asterisk1(n);
asterisk2(n-1);
}
}
public void asterisk3( int n) {
count++;
if( n == 0) {
return;
} else {
asterisk1(count);
asterisk3(n-1);
}
}
}

output:
=====

Enter a number: 10
*
**
***
****
*****
******
*******
********
*********
**********
**********
*********
********
*******
******
*****
****
***
**
*

————————–THE_END——————————————


3.circle:
——-

package p;
public class p9 {

public static void main(String[] args) {
DrawMeACircle(3, 3, 3); // should print to the screen an ellipse looking circle
}

public static void DrawMeACircle(double posX, double posY, double radius) {

double xaxis = 20; // scanning the coordinates
double yaxis = 20; // ” ”

for (double x = 0; x < xaxis; x++) {
for (double y = 0; y < yaxis; y++) {

//using the formula for a cicrle
double a = Math.abs((posX – x) * (posX – x));
double b = Math.abs((posY – y) * (posY – y));

double c = Math.abs(a + b);
double d = Math.abs(radius * radius);

// checking if the formula stands correct at each coordinate scanned
double arbitraryNumber = 2;
if ( Math.abs(c – d) < arbitraryNumber)
{

System.out.print(‘@’);
}
else {
System.out.print(‘ ‘);
}
}
System.out.println();
}
}
}

output:
=====

op2

————————THE_END——————————————

package p;

class p11
{
public static void main(String ar[])
{
int i,j,n=4,n1=2;

for(i=1;i<=4;i++)
{
for(int sp=0;sp<=n;sp++)
{
System.out.print(” “);
}

for(j=1;j<=i;j++)
{
System.out.print(“* “);
}

n–;
System.out.print(“\n”);
}

for(i=3;i>=1;i–)
{
for(int sp=0;sp<=n1;sp++)
{
System.out.print(” “);
}

for(j=i;j>=1;j–)
{
System.out.print(“* “);
}

n1++;
System.out.print(“\n”);
}
}
}
(or)
public class StarPattern
{
public static void main(String[] args)
{
System.out.print(“Enter no of row u want in star pattern : “);
Scanner in = new Scanner(System.in);
int num=in.nextInt();
for(int i=1;i<=num;i++)
{
for(int j=num;j>=i;j–)
{
System.out.print(” “);
}
for(int m=1;m<=i;m++)
{
System.out.print(” *”);
}
System.out.print(“\n”);
}
for(int i=1;i<=num;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(” “);
}
for(int m=num;m>=i;m–)
{
System.out.print(” *”);
}
System.out.print(“\n”);
}
}

}
output:

op

————————————THE_END——————

“I Love You” in different languages over the world…. .. .Express as much as u love, Express as many as u can.. .. .

Language I love you
Adyghe Сэ шІу усэлъэгъу
Afrikaans Ek’s lief vir jou
Ek het jou lief
Albanian (Gheg) Të dua
Albanian (Tosk) Të dua
Aleut Txin yaxtakuq
Alsatian Ich hàbb dir lïab
Amharic አፈቅርሻለሁ። (afekirishalehu) – f
አፈቅርሀለሁ። (afekirhalehu) – m
Arabic
(Egyptian)
>m – (ana baħibbak) ٲنَا بحِبَّك
>f – (ana baħibbik) ٲنَا بَحِبِّك
Arabic
(Lebanese)
B7ebbak (m)
B7ebbek (f)
Arabic
(Modern Standard)
(uḥibbuk) أحبك
Arabic
(Moroccan)
(kanəbġīk) كنبغيك
Arabic
(Syrian)
(bəḥibbək) بحبك
Aragonese T’amo
Arapaho Biixoo3é3en
Armenian
(Eastern)
Սիրում եմ քեզ: (Sirum em kez)
Armenian
(Western)
Կը սիրեմ քեզ: (Guh seerem kez)
Aromanian Ti voi
Assamese মই েতামাক ভালপাওঁ (moi tomaak bhaalpaao)
মই আেপানাক ভালপাওঁ (moi aaponaak bhaalpaao)
Asturian Quiérote
Atikamekw Ki micta sakihitin
Kisakihitin
Avallaen  (vüväloiek dü quuo)
Azeri Mən səni sevirəm
Bambara M’bi fe
Basque Maite zaitut
Bavarian I lieb Di
I mog Di
Belarusian Я цябе кахаю (Ja ciabe kakhaju)
Bengali আমি আপনাকে ভালোবাসি (ami apnake bhalobashi) – frm
আমি তোমাকে ভালোবাস (ami tomake bhalobashi) – inf
আমি তোকে ভালোবাস (ami toke bhalobashi) – vinf
Bhojpuri हम तोहसे प्यार करेनी (hum tohse pyaar kareni)
Bikol Namumutan ta ka
Bosnian Volim te
Breton Karout a ran ac’hanout
Da garout a ran
Me az kar
Bulgarian Обичам те (Običam te) – inf
Любя те (Ljubja te) – inf
Аз те обичам (Az te običam) – inf
Обичам Ви (Običam vi) – frm
Любя Ви (Ljubja vi) – frm
Burmese cha-ma chin go chit-teh (m)
cha-nor kin-mya go chit-teh (f)
Cape Verdean Creole Nta amabo
Nta adorabu
Catalan T’estimo
Cebuano Gihigugma ko ikaw
Cham (Western) Ai ranam dai (m>f) Dai ranam ai (f>m)
Chamorro
(Guam dialect)
Hu guiaya hao
Chamorro
(North Marianas dialect)
Hu guiaya hao
Cherokee ᎬᎨᏳᎢ (Gvgeyu’i)
Chinese
(Cantonese)
我愛你 (ngóh oi néih)
Chinese
(Hakka)
𠊎愛你 (ngai2 oi5 ngi2)
Chinese
(Mandarin)
我愛你 [我爱你] (wǒ ài nǐ)
Chinese
(Shanghainese)
侬爱你 (nguh eh non)
Chinese
(Taiwanese)
我愛你 (góa ài lì)
Chuukese Ai tong ngonuk (frm) U pe reom (inf)
Cimbrian Ich liibe-dich
Cornish My a’th kar
Corsican Ti tengu caru
Croatian Volim te
Cuyonon Inggegegma ta kaw; Inggegegma ta ka
Gegma ta kaw; Mal ta ka; Mal ta kaw
Czech Miluji tě – between partners
Mám tě rád (jako kamaráda) – between friends
Danish Jeg elsker dig
Dungan (Gansu dialect) Вә э ни (Veh ai ni)
Dungan (Shaanxi dialect) Ңə э ни (Ngeh ai ni)
Dutch Ik hou van je (inf)
Ik hou van jou
Ik hou van u (frm) – used only by lovers
Efik Mmema fi
Esperanto Mi amas vin
Estonian Ma armastan sind
Ewe Me lↄ wo
Faroese Eg elski teg
Fijian Au domoni iko / Au lomani iko
Filipino Mahal Kita / Iniibig Kita
Finnish Mä rakastan sua (inf)
Minä rakastan sinua (frm)
Frisian (North) Ik hääw de liif
Frisian (Sater) Iek hääb die ljoo
Frisian (West) Ik hâld fan dy
Ik bin wiis mei dy
Ik leavje dy
Ik leavhaw dy
French Je t’aime
Je t’adore
Friulian Ti vuei ben
Galician Ámote / Quérote
Georgian მე შენ მიყვარხარ (me shen miq’varkhar)
German Ich liebe dich
Greek (Modern) Σ΄αγαπώ (S’agapó) – inf
Σας αγαπώ (Sas aghapó) – frm
Greenlandic Asavakkit
Guarani Rojhayhû
Gujarati હું તને પ્રેમ કરુ છું (hūṃ tane prem karū chūṃ)
Gwich’in Neet’ihthan
Haitian Creole Mwen renmen w
Hausa Ina son ka (>m)
Ina son ki (>f)
Hawaiian Aloha Au Ia ʻOe / Aloha No Au Ia ʻOe
Hebrew (Ani Ohev Otach – to woman) אני אוהב אותך
(Ani Ohevet Otcha – to man) אני אוהבת אותך
Hiligaynon Palangga ko ikaw / Guina higugma ko ikaw
Hindi मैं तुम्हैं बहुत चाहता हुँ (maiṅ tumhaiṅ bahut cāhatā hūṅ) – m
मैं तुम्हैं बहुत चाहता चाहती हुँ (maiṅ tumhaiṅ bahut cāhatī hūṅ) – f
मैं तुमसे प्यार करता हुँ (maiṅ tumse pyār kartā hūṅ) – m
मैं तुमसे प्यार करती हुँ (maiṅ tumse pyār kartī hūṅ) – f
Hmong (White) Kuv hlub koj
Hungarian Szeretlek
Iban Aku sayau nuan?
Icelandic Ég elska þig
Iloko Ayayatenka / Ipatpategka / Ikarkarayoka
Indonesian Aku cinta kamu
Saya cinta kamu
Saya mencintaimu
Interlingua Io te ama
Inuktitut ᓇᒡᓕᒋᕙᒋᑦ Nagligivagit/Nalligivagit
Iñupiaq Nakuagigikpin / Nakuagikpakpin / Piqpavagin
Irish (Gaelic) Gráím thú (I love you)
Tugaim cion duit (I give you affection)
Tá cion agam ort (I have affection for you)
Tá mé ceanúil ort (I have affection for you)
Tá grá agam duit (I have love for you)
Táim i ngrá leat (I’m in love with you)
Tá mo chroí istigh ionat (My heart is within you)
Adhraím thú (I adore you)
Italian Ti amo
Japanese 好きです (suki desu)
好きだ (suki da)
好きだよ (suki dayo)
好きよ (suki yo) f
大好きです (daisuki desu)
愛してるよ (aishiteru yo)
愛してるわ (aishiteru wa) >f
Javanese Kula tresna panjengan
Aku seneng kowe
Jèrriais J’t’aime
J’t’adouthe
Kannada ನಾ ನಿನ್ನ ಪ್ರೀತಿಸ್ತೀನಿ (naa ninna preetisteeni)
Kapampangan Kaluguran daka
Kazakh Мен сені сүйемін! (Men seni süyemin!) – inf
Мен сені жақсы көремін! (Men seni jaqsı köremin!) – inf
Мен сізді сүйемін! (Men sіzdi süyemin!) – frm
Мен сізді жақсы көремін! (Men sіzdi jaqsı köremin!) – frm
Мен сізге ғашықпын! (Men sizge ğaşıqpın!) – frm
Мен саған ғашықпын! (Men sağan ğaşıqpın!) – inf
Khmer បងស្រលាញ់អូន – m>f
អូនស្រលាញ់បង – f>m
Khoekhoe (Nama) ǀNamsi ta ge a. (fm/sg)
ǀNamtsi ta ge a. (m/sg)
ǀNam ro ta ge a. (cm/dl)
ǀNam ro ta ge a. (fm/dl)
ǀNam kho ta ge a. (m/dl)
ǀNam du ta ge a. (f/cm/pl)
ǀNam go ta ge a. (m/pl)
ǀNam so ta ge a. (fm/pl)
Kinyarwanda Ndagukunda
Kirundi Ndagukunda
Klamath Moo ?ams ni stinta
Klallam Nəsƛ̕éʔ cxʷ
Korean 사랑해 (sarang hae)
Kurdish (Kurmanji) Ez te hez dikem
Kurdish (Sorani) Xoştim dewê; Min tom xoş dewêt; Ji te hez dikîm
Kyrgyz Мен сени сүйөм! (Men seni süyöm!) – sg/inf
Ladino (Te amo) טי אמו
Lakota Sioux Thečhíȟila
Iyótaŋčhila
Čhaŋtóčhignake
Latin Te amo
Latvian Es tevi mīlu
Lithuanian Aš tave myliu
Lojban mi do prami
Low Saxon Ik hou van di
Lozi Na ku lata
Lule Sámi Mån æhtsáv duv
Luo Aheri
Luxembourgish Ech hunn dech gär / Ech si frou mat dir
Macedonian Те сакам (Te sakam), Те љубам (Te lyubam) – inf
Ве сакам (Ve sakam), Ве љубам (Ve lyubam) – frm
Maithili हम अहाँ स प्रेम करेछी (hawm ahāṃ se prem karechi)
Malagasy Tiako ianao
Malay Saya sayang kamu
Aku cintakan kau
Aku cinta padamu
Aku mencintaimu
Malayalam ഞാന്‍ നിന്നെ പ്രേമിക്കുന്നു
(njan ninne premikkunnu)
Maltese Inħobbok / Inħobbok hafna / Jien inħobbek
Mam Wajb’ila ti’ja … nlaq wanmiya ti’ja
Manchu Bi shimbe hairambi
Manx (Gaelic) Ta graih aym ort
Māori Kei te aroha au ki a koe
Marathi माझ तुइयावर प्रेम आहे (Mājha tuiyāvar prem āhe)
Mazanderani Tere del devesteme
Mi’kmaq kesalul
Mixtec (Alcozauca) Ku toulló ñeloosí
Mongolian Би чамд хайртай (Bi chamd khairtai)
Montagnais Tshemenuadeden (I love you)
Tsheshuenemeden (I love you a lot)
Nahuatl Nimitztlazohtla / Nimitznequi
Navajo Ayóó ánííníshí
Ayóó ánóshí
Ndebele (Northern) Ngiyakuthanda
Ndebele (Southern) Ngiyakuthanda
Nepali म तपाइलाइ माया गर्छु।
(ma tapainlai maya garchu)
Newari / Nepal Bhasa जितः छ नापं मतिना दु।
Northern Sotho Ke a go rata
Northern Sámi Mun ráhkistan du
Norwegian Jeg elsker deg (BM)
Eg elskar deg (NN)
Occitan T’aimiT’estimi
Ojibwe Gi zah gin
Okinawan 好ちゅさ一(shichusaa)
我んね一御所愛さんでぃ思と一いび一ん
(wannee unju kanasa ndi umutooibiin) – frm
Old English Ic lufie þe (West Saxon) Ic lufie þec (Northumbrian)
Old French Aim te
Old Spanish Amo te
Oriya ମୁଁ ତୁମକୁ ଭଲ ପାଏ (mu tumoku bhala paye)
Otomi (Mezquital) Hmädi
Palauan A Kultoir er Kau
Pangasinan Inaru Taka
Papiamento Mi ta stimabo (frm)
Mi stimabo (inf)
Pashto زه ستا سره مينه کوم
(za la ta sara meena kawom)
Persian (Farsi) (asheghetam) عاشقتم
used in poetry and songs – (dūset dāram) دوست دارم
Polish Kocham Cię
Portuguese Amo-o (frm>m)
Amo-a (frm>f)
Adoro-te (inf)
Adoro-o (frm>m)
Adoro-a (frm>f)
Portuguese (Brazilian) Amo-te
Eu te amo
Eu gosto de você
Eu amo você
Eu adoro você (I adore you)
Eu tenho carinho por você (I have affection for you)
Pulaar Mi yidi maa
Punjabi ਮੈਂ ਤੈਨੂੰ ਪਿਆਰ ਕਰਦਾ ਹਾਂ। / میں تینوں پیار کردا ہاں
(mẽ tenū̃ piār kardā hā̃)
Romanian Te iubesc
Romansh Jeu carezel tei
Russian Я тебя люблю! (Ja teb’a l’ubl’u!) – inf
Я вас люблю! (Ja vas l’ubl’u!) – frm
Sakha Мин эйиигин таптыыбын (min ejiigin taptɯɯbɯn)
Samoan Ou te alofa ia te oe
Sanskrit त्वामनुरजामि (twāmanurajāmi)
Sardinian
(Logudorese)
T’amo
Scots A love ye
Scottish Gaelic Tha gaol agam ort
Serbian Волим те (Volim te)
Sesotho Ke a o rata
Tswana Ke a go rata
Shona Ndinokuda
Sicilian T’amu (between lovers)
Ti vogghiu (“I want you” – between lovers)
Ti vogghiu beni (for friends, relatives, etc)
Sinhala මම ඔයාට ආදරෙයි (mama oyāṭa ādareyi)
Slovak Ľúbim Ťa
Slovenian Ljubim te (m/f)
Rad te imam (m)
Rada te imam (f)
Somali Waan ku jecelahay
Soninke Nga m’afini
Southern Sámi Manne datnem eahtsam
Spanish Te amo
Te quiero
Swahili Ninakupenda
Swazi Ngiyakutsandza
Swedish Jag älskar dig
Swiss German Ich liib dich / I ha Di gärn
Tagalog Iniibig kita
Mahal Kita
Minamahal Kita
Iniirog kita (old fashioned)
Tahitian Ua here vau ia oe
Tamil நான் உன்னை காதலிக்கிறேன்
(nān unnai kādhalikkiren)
Tatar Min sini yaratam/söyäm
Telugu నేను నిన్ను ప్రేమిస్తున్నాను
(naenu ninnu praemisthunnaanu)
Temne Eborithimu
Tetum Hau hadomi O
Thai ผมรักคุณ (pŏm rák kun) – m
ฉันรักคุณ (chăn rák kun) – f
Tibetan ང་ཁྱེད་རང་ལ་དགའ་པོ་ཡོད་ (nga kayrâng-la gawpo yö)
Tigrinya ይፈትወካ`የ! (Yfetwekaye) m/sg
የፍቅረካ`የ! (Yefkrekaye) m/sg
ይፈትወኪ’የ! (Yfetwekiye) f/sg
የፍቅረኪ’የ! (Yefkrekiye) f/sg
Tlingit Ix̱six̱àan
Tok Pisin Mi lavim yu
Tongan ‘Oku ou ‘ofa ‘ia koe
Tsez Даьр ми йетих (Där mi yetix) >f
Даьр ми этих (Där mi etix) >m
Tshivenḓa Ndi a ni funa
Tswana Ke a go rata
Turkish Seni seviyorum
Ukrainian Я тебе кохаю (Ja tebe kochaju)
Я тебе люблю (Ja tebe liubliu)
Urdu میں آپ سے محبت کَرتا ہوں
m (mein ap say muhabat karta hoon)
میں آپ سے محبت کرتی ہوں
f (mein ap say muhabat karti hoon)
Uzbek Men seni sevaman
Venetian Te vògio ben
Vietnamese Em yêu anh (>m)
Anh yêu em (>f)
Volapük Läfob oli
Võro (Ma) armasta sinno
Walloon Dji t’veû vol’tî
Welsh Dw i’n dy garu di / Rwy’n dy garu di
Wolof Begg naa la (general)
Sopp naa la (I admire you – when courting)
Nopp naa la (between partners)
Xhosa Ndiyakuthanda
Xitsonga Ndza ku rhandza
Yapese Gu ba’adag em
Yiddish (Ikh hob dikh lieb) איך האָב דיך ליב
(Ikh libe dikh) איך ליבע דיך
Yolngu Ŋarra djäl nhuna
Yoruba Mo nifẹẹ rẹ
Yucatec Maya In k’áatech
Yup’ik Kenkamken
Zapotec Nadxiie lii
Zazaki Ez to has kenan
Zulu Ngiyakuthanda

 

“this” Keyword and its usage in java … .. .

 

 

What is  “this “

this  is a keyword in Java. Which can be used  as a reference to current object whose method or constructor is being invoked. this keyword can be used to refer any member of current object from within an instance method or a constructor.It will always points to current underlying reference object.

this USES:
———-
1. u can seperate global values and local variables with help of me.
2. To know current underlying object reference
3. this() constructor call can be used to invoke the current class constructor .
4.The this() constructor call can be used to reuse the constructor passed parameter value in the another constructor.
5. To invoke the method of the current class by using the this keyword.
6.To invoke constructor of the current class by using the this keyword.

public class This1
{
static int value1=20;
int value2=50;
//global variables
void m1(int value1,int value2)
{
int value11= value1;
int value21=value2;
System.out.println(“we are local variables, we will change with respect to object reference”);
System.out.println(value11);
System.out.println(value21);
System.out.println();
//object level variable
//NON_STATIC
System.out.println(“we are global variables,we are same for all instance varaiable reference”);
System.out.println(this.value1);
System.out.println(this.value2);
System.out.println();
//class level variable
//STATIC

}
public static void main(String[] args)
{
This1 t1=new This1();
This1 t2=new This1();
System.out.println(“im this , u can seperate global values and local variables with help of me “);
System.out.println();
t1.m1(25,55);
t2.m1(30,60);
}
}

………..
OUTPUT:
………..
im this , u can seperate global values and local variables with help of me

we are local variables, we will change with respect to object reference
25
55

we are global variables,we are same for all instance varaiable reference
20
50

we are local variables, we will change with respect to object reference
30
60

we are global variables,we are same for all instance varaiable reference
20
50

……………………………………………………………………………………………….

2.
public class This2
{

public static void main(String[] args)
{
This2 t1=new This2();
This2 t2=new This2();
System.out.println(t1.hashCode());
System.out.println(t1.toString());
System.out.println(t1.getClass());
System.out.println();
System.out.println(t2.hashCode());
System.out.println(t2.toString());
System.out.println(t2.getClass());

}
}
———–
output
———–

1704856573
This2@659e0bfd
class This2

705927765
This2@2a139a55
class This2

…………………………………………………………………………………………………..
3.

class This3
{
int id;
String name;

This3(int id,String name)
{
id = id;
name = name;
}
void display()
{

System.out.println(id+” “+name);
}

public static void main(String args[]){
This3 t1 = new This3(123,”sahul”);
This3 t2 = new This3(124,”ammu”);
System.out.println(“here we getting 0,null as values bcz of ambiguity b/w parameter varialbles and instance ones.”);
t1.display();
t2.display();
}
}
class This4
{
int id;
String name;

This4(int id,String name)
{
this.id = id;
this.name = name;
}
void display()
{

System.out.println(id+” “+name);

}
public static void main(String args[])
{
This4 t3 = new This4(123,”sahul”);
This4 t4 = new This4(124,”ammu”);
System.out.println(“here we are getting user defined variable values bcz of this is pointing to current object”);
t3.display();
t4.display();
}
}

———-
output
———-

java This3
……….
here we getting 0,null as values bcz of ambiguity b/w parameter varialbles and instance ones.
0 null
0 null

java This4
………..
here we are getting user defined variable values bcz of this is pointing to current object
123 sahul
124 ammu
…………………………………………………………………………………………………………………

3.
class This51
{
int id;
This51()
{
System.out.println(” This51 class default constructor “);
}

This51(int id)
{
this ();
// invokes current class constructor.
this.id = id;
}
void display()
{
System.out.println(id);

}
}
class This5
{
int id;
This5()
{
System.out.println(“This5 class default constructor “);
}

This5(int id)
{
this ();
// invokes current class constructor.
this.id = id;
}
void display()
{
System.out.println(id);

}

public static void main(String args[]){
This5 t1 = new This5(5);
This51 t2 = new This51(51);
t1.display();
t2.display();
}
}
————–
output
————–

This5 class default constructor
This51 class default constructor
5
51
……………………………………………………………………………………………………….
4.

class This6
{
int id;
String name;
This6(int id)
{
System.out.println(“This6 !-param class constructor “);
this.id=id;
}

This6(int id,String name)
{
this(id);
this.name=name;
}
void display()
{
System.out.println(id+” “+name);

}

public static void main(String args[]){
This6 t1 = new This6(123);
This6 t2 = new This6(125, “siddarth”);
t1.display();
t2.display();
}
}
———-
output
———-
This6 !-param class constructor
This6 !-param class constructor
123 null
125 siddarth
…………………………………………………………………………………………………………..

5.
class This7
{
void m1()
{
System.out.println(“iam m1()method “);
}
void m2()
{
System.out.println(“iam m2() method”);
this.m1();
//invokes m1()
}
void m3()
{
System.out.println(“iam m3() method”);
System.out.println();
this.m2();
System.out.println();
this.m1();
System.out.println();
//invokes m2()
//invokes m1()
}

public static void main(String args[])
{
This7 t1 = new This7();
t1.m3();
}
}
———
output
———-
iam m3() method

iam m2() method
iam m1()method

iam m1()method
m2()==this.m2(); in this case
……………………………………………………………………………………………………..
6.

class This10
{
This9 objThis9;
This10(This9 objThis9)
{
this.objThis9=objThis9;
}
void display()
{
System.out.println(objThis9.a);
System.out.println(objThis9.s1);
}
}

class This9
{
int a=123;
String s1=”sahul”;
This9()
{
This10 t2=new This10(this);
t2.display();
}
public static void main(String args[])
{
This9 a=new This9();
}
}

—————
output
—————

123
sahul
……………………………………………………………………………………………………….

7.

class A
{

A display1()
{
return this;
}
void display()
{
System.out.println(“Hi this is sahul”);
}

}
public class This11
{
public static void main(String[] args)
{
A obj=new A();
obj.display1();

}
}

 

 

For more info regarding this u can get it at below link:https://docs.oracle.com/javase/tutorial/java/javaOO/thiskey.html

 

 

Difference between GET and POST methods… .. .

The two most used HTTP methods are: GET and POST.


What is HTTP?

The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers.

HTTP works as a request-response protocol between a client and server.

A web browser may be the client, and an application on a computer that hosts a web site may be the server.

Example: A client (browser) submits an HTTP request to the server; then the server returns a response to the client. The response contains status information about the request and may also contain the requested content.


Two HTTP Request Methods: GET and POST

Two commonly used methods for a request-response between a client and server are: GET and POST.

  • GET – Requests data from a specified resource
  • POST – Submits data to be processed to a specified resource

 

 Here we distinguish the major differences :

ASCII values of keyboard keys… .. .

12036781_847987971985390_994745336818203478_n

 

ASCII ( i/ˈæski/ ASS-kee), abbreviated from American Standard Code for Information Interchange, is a character-encoding scheme (the IANA prefers the name US-ASCII). ASCIIcodes represent text in computers, communications equipment, and other devices that use text.

 

ASCII code is the numerical representation of a character such as ‘a’ or ‘@’ or an action of some sort. ASCII was developed a long time ago and now the non-printing characters are rarely used for their original purpose. Below is the ASCII character table and this includes descriptions of the first 32 non-printing characters. ASCII was actually designed for use with teletypes and so the descriptions are somewhat obscure. If someone says they want your CV however in ASCII format, all this means is they want ‘plain’ text with no formatting such as tabs, bold or underscoring – the raw format that any computer can understand. This is usually so they can easily import the file into their own applications without issues. Notepad.exe creates ASCII text, or in MS Word you can save a file as ‘text only’.

 

 

asciifull