5.4 Java Trick | Print Hello World without using Semicolon

preview_player
Показать описание
Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.

Follow on Facebook:

Subscribe to our other channel:
Telusko Hindi :

Subscribe to the channel and learn Programming in easy way.

Рекомендации по теме
Комментарии
Автор

Sir, actually printf inside if or while etc.. even works in C language. The main trick is printf returns a value which satisfies the if condition. Anyway this is an awesome trick Sir.

infidarkstudios
Автор

Just the kind of thing you could catch in a question in the OCA or OCP exams!

thearm
Автор

Hello Navin!!
What's the use by printing Hello World without Semicolon??

vivekajmeera
Автор

sir, the following statement also prints without using semicolon

print here"));

of course, it prints reference of sout and I didn't use semicolon for inner sout.

charanguggulla
Автор

If printf returns PrintStream then the condition == null must be false?

veereshcharantimath
Автор

hello sir.... the statement was working even without a semicolon...on netbeans 7.4

parthtrehan
Автор

you know dude that was awesome, keep it up, i am watching your vids daily

shaileshsingh
Автор

amazing
i know new thing in my programing life

gopalbharadva
Автор

how did you entered inside that printf, what did u pressed to see details about printstream?

shivrajpujari
Автор

If we write printf instead of println then directly output is coming writing if condition, why

sgcftw
Автор

What ll happened if we use "println" Instead of printf;

shambhwishikha
Автор

for example look at my program
class PrintWithoutSemicolon
{
public static void main(String[] args)
{int i=10;
if(System.out.printf("hello word")== null)
{

System.out.println(i);
}
else
{
int j;
j=++i;
System.out.println(j);
}}}
whats happning here is as sir said printf is returning printsteam(means the string the we provided) which is obviously not equal to null thats why condition failed and going to else statment an giving value 11.returning in the sence it's printing the string
hope it helped

sunnyraj
Автор

if(System.out.append("Lalji prajapati\n").equals(null)){}

laljiprajapati
Автор

i am unable to get the output in notepad i mean not in ides?

jayaprakashveldanda
Автор

Hello
It works for me without this trick in mean to say i have written a code like this
package javaapplication3;

public class JavaApplication3
{


public static void main(String[] args)
{
System.out.println("Hello")
}

}
and this gives me no error in netbeans and gives the output.why? but gives the error in cmd as it is
and 1 more ques it necessary to use curly braces for if statement every time because it gives a error in cmd but nor in answer sir

mohangupta
Автор

i wanna know netbeans ignore the error of ; or not????

sushmasharma
Автор

why void type method(println) cant be used with == operator? anyone help

mouparnabag
Автор

why "sout" isn't working in eclipse?

indappun
Автор

Sir, what exactly is happening?
Explain in the detail & tell us about the theoretical part also... please

arjunkhanna
Автор

if condition returns false here because it doesn't return null. But, how does the statement present in the condition gets printed?

TheYashwanth