Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!

# Help on a program

Ankit Up
Greenhorn
Posts: 4
Write a program with two constant values, one with alternating binary ones and zeroes, with a zero in the least-significant digit, and the second, also alternating, with a one in the least-significant digit (hint: Itâ€™s easiest to use hexadecimal constants for this). Take these two values and combine them in all possible ways using the bitwise operators, and display the results using Integer.toBinaryString( ).

Repeat Exercise using the ternary operator and a bitwise test to display the ones and zeroes, instead of Integer.toBinaryString( ).

This is a question from TIJ4
I have done the first exercise but unable to do second.I cann't understand it.I couldn't think of anything about it.
I am new to java.Your help will be appreciated.

Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15568
46
Welcome to JavaRanch.

So, what exactly do you not understand about it? Do you know what the ternary operator is? If not, did you try to Google it?

Maneesh Godbole
Saloon Keeper
Posts: 11257
16
"Ankit Up"

Greenhorn
Posts: 1
hi,how to print * symbol in diamond shape

Rob Spoor
Sheriff
Posts: 20709
68
geetha garlapad wrote:hi,how to print * symbol in diamond shape