Skip to main content

Posts

String Array

  Array:  1.String array class Main{ /*Every application in Java must contain the main method. The Java compiler starts executing the code from the main method*/     public static void main(String anyVar[]){                  String [] array={"1","2","3"};          System.out.println("default values of string array:"+array);          System.out.println("values for string array\nstring array[0]:"+array[0]+"\nstring array[1]:"+array[1]+     "\nstring array[2]:"+array[2]);      } Output: default values of string array:[Ljava.lang.String;@2a139a55                                                ...

intArray

Array:  1.int array class Main{ /*Every application in Java must contain the main method. The Java compiler starts executing the code from the main method*/     public static void main(String anyVar[]){                  int [] array={1,2,3};          System.out.println("default values of int array:"+array);          System.out.println("values for int array\nint array[0]:"+array[0]+"\nint array[1]:"+array[1]+"\nint array[2]:"+array[2]);      } Output: default values of int array:[I@2a139a55                                                            ...

Simple java code

  Simple java code class Main{ /*Every application in Java must contain the main method. The Java compiler starts executing the code from the main method*/      public static void main(String anyVar[]){      System.out.println("Simple java code");       } } Output: Simple java code Screenshot: Online compiler:https://www.onlinegdb.com/online_java_compiler #happyCoding💁👍

Apache Beam

First code in Apache Beam word count example: Word count .java file-> package com.test.training; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.io.TextIO; import org.apache.beam.sdk.options.PipelineOptions; import org.apache.beam.sdk.options.PipelineOptionsFactory; import org.apache.beam.sdk.transforms.Count; import org.apache.beam.sdk.transforms.DoFn; import org.apache.beam.sdk.transforms.Filter; import org.apache.beam.sdk.transforms.FlatMapElements; import org.apache.beam.sdk.transforms.MapElements; import org.apache.beam.sdk.transforms.ParDo; import org.apache.beam.sdk.values.KV; import org.apache.beam.sdk.values.PCollection; import org.apache.beam.sdk.values.TypeDescriptors; public class BasicWordCountWithExplaination { public static void main(String[] args) { // Create a PipelineOptions object. This object lets us set various execution     // options for our pipeline, such as the runner you w...
code Snippets What will be the output of the following programs? ???? //static var 1.int x = 10;    static int y = x; //infinite loop     2.  for (i = 1; i != 10; i += 2)    {      printf ( " hi " );    } 3.int i = 20,j;      i = ( printf ( "Hello" ), printf ( "dear... " ));      printf ( "%d" , i);
AlphaGo: AlphaGo is a computer program that plays the board game Go. It was developed by  Alphabet Inc. 's  Google DeepMind  in London.  Google made history when its DeepMind-designed AI beat Go world champion Lee Se-dol  not just once but twice .