[MINOR][DOCS] ForeachBatch java example fix
[MINOR][DOCS] ForeachBatch java example fix

### What changes were proposed in this pull request?
ForEachBatch Java example was incorrect

### Why are the changes needed?
Example did not compile

### Does this PR introduce any user-facing change?
Yes, to docs.

### How was this patch tested?
In IDE.

Closes #27740 from roland1982/foreachwriter_java_example_fix.

Authored-by: roland-ondeviceresearch <0d270388f2f92757a5de0f4bd891d3b392c44c4f@ondeviceresearch.com>
Signed-off-by: Sean Owen <d519fa33a62684a61ab04b24d26f83452d51b34c@gmail.com>

kevinyu98/spark,taroplus/spark,WeichenXu123/spark,gengliangwang/spark,HyukjinKwon/spark,spark-test/spark,gengliangwang/spark,srowen/spark,zuotingbing/spark,HyukjinKwon/spark,witgo/spark,dbtsai/spark,kevinyu98/spark,holdenk/spark,shuangshuangwang/spark,chuckchen/spark,rednaxelafx/apache-spark,nchammas/spark,BryanCutler/spark,vinodkc/spark,jiangxb1987/spark,wangyum/spark,witgo/spark,jiangxb1987/spark,jiangxb1987/spark,mahak/spark,holdenk/spark,wzhfy/spark,WeichenXu123/spark,shuangshuangwang/spark,kevinyu98/spark,nchammas/spark,zero323/spark,mahak/spark,zzcclp/spark,zuotingbing/spark,ptkool/spark,taroplus/spark,JoshRosen/spark,srowen/spark,gengliangwang/spark,mahak/spark,ConeyLiu/spark,xuanyuanking/spark,BryanCutler/spark,BryanCutler/spark,matthewfranglen/spark,milliman/spark,cloud-fan/spark,jiangxb1987/spark,nchammas/spark,ueshin/apache-spark,ConeyLiu/spark,taroplus/spark,JoshRosen/spark,taroplus/spark,wangyum/spark,gengliangwang/spark,maropu/spark,dongjoon-hyun/spark,cloud-fan/spark,mahak/spark,zero323/spark,wzhfy/spark,JoshRosen/spark,wangyum/spark,cloud-fan/spark,wangmiao1981/spark,shuangshuangwang/spark,wzhfy/spark,chuckchen/spark,JoshRosen/spark,WeichenXu123/spark,maropu/spark,taroplus/spark,witgo/spark,zero323/spark,jiangxb1987/spark,spark-test/spark,wangmiao1981/spark,holdenk/spark,zzcclp/spark,ueshin/apache-spark,milliman/spark,goldmedal/spark,witgo/spark,shaneknapp/spark,kevinyu98/spark,mahak/spark,ConeyLiu/spark,jiangxb1987/spark,holdenk/spark,zzcclp/spark,skonto/spark,zuotingbing/spark,zuotingbing/spark,ueshin/apache-spark,skonto/spark,skonto/spark,kevinyu98/spark,xuanyuanking/spark,dongjoon-hyun/spark,ptkool/spark,milliman/spark,vinodkc/spark,hvanhovell/spark,dbtsai/spark,hvanhovell/spark,vinodkc/spark,chuckchen/spark,shuangshuangwang/spark,gengliangwang/spark,wangyum/spark,maropu/spark,dongjoon-hyun/spark,nchammas/spark,kevinyu98/spark,xuanyuanking/spark,vinodkc/spark,xuanyuanking/spark,shaneknapp/spark,WeichenXu123/spark,wangmiao1981/spark,ptkool/spark,apache/spark,wangmiao1981/spark,holdenk/spark,ConeyLiu/spark,apache/spark,goldmedal/spark,ueshin/apache-spark,BryanCutler/spark,wzhfy/spark,rednaxelafx/apache-spark,spark-test/spark,cloud-fan/spark,wzhfy/spark,vinodkc/spark,mahak/spark,HyukjinKwon/spark,nchammas/spark,BryanCutler/spark,ptkool/spark,dbtsai/spark,zuotingbing/spark,maropu/spark,skonto/spark,rednaxelafx/apache-spark,dbtsai/spark,rednaxelafx/apache-spark,nchammas/spark,wangmiao1981/spark,apache/spark,rednaxelafx/apache-spark,wangyum/spark,milliman/spark,zzcclp/spark,shuangshuangwang/spark,JoshRosen/spark,apache/spark,zero323/spark,goldmedal/spark,zzcclp/spark,dongjoon-hyun/spark,shuangshuangwang/spark,dbtsai/spark,maropu/spark,shaneknapp/spark,spark-test/spark,jiangxb1987/spark,hvanhovell/spark,srowen/spark,wangyum/spark,shaneknapp/spark,dongjoon-hyun/spark,WeichenXu123/spark,goldmedal/spark,srowen/spark,milliman/spark,zero323/spark,ConeyLiu/spark,ConeyLiu/spark,zuotingbing/spark,wangmiao1981/spark,JoshRosen/spark,ptkool/spark,WeichenXu123/spark,kevinyu98/spark,dbtsai/spark,apache/spark,xuanyuanking/spark,ueshin/apache-spark,hvanhovell/spark,witgo/spark,JoshRosen/spark,skonto/spark,dbtsai/spark,zzcclp/spark,vinodkc/spark,hvanhovell/spark,apache/spark,HyukjinKwon/spark,goldmedal/spark,ptkool/spark,BryanCutler/spark,zero323/spark,vinodkc/spark,xuanyuanking/spark,witgo/spark,cloud-fan/spark,hvanhovell/spark,wangyum/spark,chuckchen/spark,apache/spark,zuotingbing/spark,chuckchen/spark,ptkool/spark,rednaxelafx/apache-spark,taroplus/spark,ConeyLiu/spark,wzhfy/spark,ueshin/apache-spark,milliman/spark,wzhfy/spark,srowen/spark,gengliangwang/spark,holdenk/spark,rednaxelafx/apache-spark,dongjoon-hyun/spark,BryanCutler/spark,wangmiao1981/spark,cloud-fan/spark,milliman/spark,HyukjinKwon/spark,skonto/spark,WeichenXu123/spark,shaneknapp/spark,gengliangwang/spark,chuckchen/spark,srowen/spark,cloud-fan/spark,srowen/spark,spark-test/spark,HyukjinKwon/spark,mahak/spark,shaneknapp/spark,ueshin/apache-spark,hvanhovell/spark,xuanyuanking/spark,holdenk/spark,nchammas/spark,shuangshuangwang/spark,skonto/spark,witgo/spark,spark-test/spark,spark-test/spark,shaneknapp/spark,dongjoon-hyun/spark,taroplus/spark,chuckchen/spark,zzcclp/spark,goldmedal/spark,maropu/spark,goldmedal/spark,maropu/spark,zero323/spark,HyukjinKwon/spark